diff --git a/fbchat/__init__.py b/fbchat/__init__.py index 440dfa8..c8c5831 100644 --- a/fbchat/__init__.py +++ b/fbchat/__init__.py @@ -43,4 +43,4 @@ __license__ = "BSD 3-Clause" __author__ = "Taehoon Kim; Moreels Pieter-Jan; Mads Marquart" __email__ = "carpedm20@gmail.com" -__all__ = ["Client"] +__all__ = ("Client",) diff --git a/fbchat/_graphql.py b/fbchat/_graphql.py index fb9f857..1d4f220 100644 --- a/fbchat/_graphql.py +++ b/fbchat/_graphql.py @@ -1,8 +1,7 @@ import json import re from ._core import log -from . import _util -from ._exception import FBchatException +from . import _util, _exception # Shameless copy from https://stackoverflow.com/a/8730674 FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL @@ -40,7 +39,9 @@ def response_to_json(content): try: j = json.loads(content, cls=ConcatJSONDecoder) except Exception: - raise FBchatException("Error while parsing JSON: {}".format(repr(content))) + raise _exception.FBchatException( + "Error while parsing JSON: {!r}".format(content) + ) rtn = [None] * (len(j)) for x in j: diff --git a/fbchat/_state.py b/fbchat/_state.py index a81adf0..e11e2f6 100644 --- a/fbchat/_state.py +++ b/fbchat/_state.py @@ -3,6 +3,7 @@ import bs4 import re import requests import random +import urllib.parse from ._core import log from . import _graphql, _util, _exception @@ -35,7 +36,7 @@ def client_id_factory(): def is_home(url): - parts = _util.urlparse(url) + parts = urllib.parse.urlparse(url) # Check the urls `/home.php` and `/` return "home" in parts.path or "/" == parts.path