diff --git a/fbchat/_client.py b/fbchat/_client.py index 4f0f879..f19f620 100644 --- a/fbchat/_client.py +++ b/fbchat/_client.py @@ -111,8 +111,8 @@ class Client(object): def _get(self, url, params): return self._state._get(url, params) - def _post(self, url, params, files=None, as_graphql=False): - return self._state._post(url, params, files=files, as_graphql=as_graphql) + def _post(self, url, params, files=None): + return self._state._post(url, params, files=files) def _payload_post(self, url, data, files=None): return self._state._payload_post(url, data, files=files) @@ -129,12 +129,7 @@ class Client(object): Raises: FBchatException: If request failed """ - data = { - "method": "GET", - "response_format": "json", - "queries": _graphql.queries_to_json(*queries), - } - return tuple(self._post("/api/graphqlbatch/", data, as_graphql=True)) + return tuple(self._state._graphql_requests(*queries)) def graphql_request(self, query): """Shorthand for ``graphql_requests(query)[0]``. diff --git a/fbchat/_state.py b/fbchat/_state.py index c22b826..fb7e0d7 100644 --- a/fbchat/_state.py +++ b/fbchat/_state.py @@ -247,3 +247,11 @@ class State(object): return j["payload"] except (KeyError, TypeError): raise _exception.FBchatException("Missing payload: {}".format(j)) + + def _graphql_requests(self, *queries): + data = { + "method": "GET", + "response_format": "json", + "queries": _graphql.queries_to_json(*queries), + } + return self._post("/api/graphqlbatch/", data, as_graphql=True)