GQL-fork
Since the original gql
is not published to the next version, which includes some important feature, we fork and push the latest version to pypi. This repo is maintained until the original author publish 0.2.0.
Install from terminal:
pip install gql-fork
Then you can use it like the good old days:
from gql import gql, Client
from gql.transport.requests import RequestsHTTPTransport
_transport = RequestsHTTPTransport(
url=url,
use_json=True,
)
client = Client(
retries=3,
transport=_transport,
fetch_schema_from_transport=True,
)
query = gql('''
{
hello
}
''')
client.execute(query)
Original README
This is a GraphQL client for Python.
Plays nicely with graphene
, graphql-core
, graphql-js
and any other GraphQL implementation compatible with the spec.
GQL architecture is inspired by React-Relay
and Apollo-Client
.
Installation
$ pip install gql
Usage
The example below shows how you can execute queries against a local schema.
from gql import gql, Client
client = Client(schema=schema)
query = gql('''
{
hello
}
''')
client.execute(query)