Small fixes

This commit is contained in:
Mads Marquart
2019-08-28 23:03:31 +02:00
parent da4ed73ec6
commit 8052b818de
3 changed files with 7 additions and 5 deletions

View File

@@ -43,4 +43,4 @@ __license__ = "BSD 3-Clause"
__author__ = "Taehoon Kim; Moreels Pieter-Jan; Mads Marquart" __author__ = "Taehoon Kim; Moreels Pieter-Jan; Mads Marquart"
__email__ = "carpedm20@gmail.com" __email__ = "carpedm20@gmail.com"
__all__ = ["Client"] __all__ = ("Client",)

View File

@@ -1,8 +1,7 @@
import json import json
import re import re
from ._core import log from ._core import log
from . import _util from . import _util, _exception
from ._exception import FBchatException
# Shameless copy from https://stackoverflow.com/a/8730674 # Shameless copy from https://stackoverflow.com/a/8730674
FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL
@@ -40,7 +39,9 @@ def response_to_json(content):
try: try:
j = json.loads(content, cls=ConcatJSONDecoder) j = json.loads(content, cls=ConcatJSONDecoder)
except Exception: 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)) rtn = [None] * (len(j))
for x in j: for x in j:

View File

@@ -3,6 +3,7 @@ import bs4
import re import re
import requests import requests
import random import random
import urllib.parse
from ._core import log from ._core import log
from . import _graphql, _util, _exception from . import _graphql, _util, _exception
@@ -35,7 +36,7 @@ def client_id_factory():
def is_home(url): def is_home(url):
parts = _util.urlparse(url) parts = urllib.parse.urlparse(url)
# Check the urls `/home.php` and `/` # Check the urls `/home.php` and `/`
return "home" in parts.path or "/" == parts.path return "home" in parts.path or "/" == parts.path