From 28c867a115d6aa9cd0673768c33fd3f788f6f15b Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Sun, 10 Mar 2019 19:54:36 +0100 Subject: [PATCH] Simplify _graphql.py imports --- fbchat/_graphql.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/fbchat/_graphql.py b/fbchat/_graphql.py index 37b5a3b..72ba3c1 100644 --- a/fbchat/_graphql.py +++ b/fbchat/_graphql.py @@ -1,11 +1,10 @@ # -*- coding: UTF-8 -*- - from __future__ import unicode_literals + import json import re -from . import _file, _message, _quick_reply -from .models import * -from ._util import * +from . import _util +from ._exception import FBchatException, FBchatUserError # Shameless copy from https://stackoverflow.com/a/8730674 FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL @@ -39,7 +38,7 @@ def graphql_queries_to_json(*queries): def graphql_response_to_json(content): - content = strip_to_json(content) # Usually only needed in some error cases + content = _util.strip_to_json(content) # Usually only needed in some error cases try: j = json.loads(content, cls=ConcatJSONDecoder) except Exception: @@ -50,15 +49,15 @@ def graphql_response_to_json(content): if "error_results" in x: del rtn[-1] continue - check_json(x) + _util.check_json(x) [(key, value)] = x.items() - check_json(value) + _util.check_json(value) if "response" in value: rtn[int(key[1:])] = value["response"] else: rtn[int(key[1:])] = value["data"] - log.debug(rtn) + _util.log.debug(rtn) return rtn