A blazingly fast and modern graphql client based on qlient-core and aiohttp
- Compatible with Python 3.7 and above
- Build on top of
qlient-core
andaiohttp
- support for subscriptions
See the documentation for more details.
This preview is using the official github/graphql/swapi-graphql graphql api.
import asyncio
from qlient.aiohttp import AIOHTTPClient, GraphQLResponse
async def main():
async with AIOHTTPClient("https://swapi-graphql.netlify.app/.netlify/functions/index") as client:
result: GraphQLResponse = await client.query.film(
["title", "id"], # fields selection
id="ZmlsbXM6MQ==" # query arguments
)
print(result.request.query)
print(result.data)
asyncio.run(main())
Which results in the following query being sent to the server
query film($id: ID) {
film(id: $id) {
title
id
}
}
And returns the body below
{
"film": {
"title": "A New Hope",
"id": "ZmlsbXM6MQ=="
}
}