mkt.databases.api_schema.GraphQLClient
- class mkt.databases.api_schema.GraphQLClient(url: str | None = None, query_string: str | None = None, variables: dict = <factory>, response: dict | None = None)[source]
Bases:
APIClientBase class for GraphQL API clients.
- __init__(url: str | None = None, query_string: str | None = None, variables: dict = <factory>, response: dict | None = None) None
Methods
__eq__(other)Return self==value.
__init__([url, query_string, variables, ...])__post_init__()Initialize the GraphQL API client.
_stamp_from_response(res)Record query datetime + cache provenance from a requests-cache response.
_stamp_now()Record current UTC datetime; cache provenance unknown.
check_response(res)Check the response status code for errors.
Query a GraphQL API and return result.
Attributes
__dataclass_fields____dataclass_params____match_args__from_cacheWhether the most recent response was served from requests-cache.
query_datetimeUTC datetime the underlying network query was made (cache creation time if served from cache).
GraphQL query string to be executed.
Response from the GraphQL API query, if any.
GraphQL API URL.
Variables for the GraphQL query, if any.
- __init__(url: str | None = None, query_string: str | None = None, variables: dict = <factory>, response: dict | None = None) None
- query_api() dict[source]
Query a GraphQL API and return result.
- Returns:
API response
- Return type:
dict
- query_string: str | None = None
GraphQL query string to be executed.
- response: dict | None = None
Response from the GraphQL API query, if any.
- url: str | None = None
GraphQL API URL.
- variables: dict
Variables for the GraphQL query, if any.