An asynchronous Python library for interaction with GraphQL APIs.
source | documentation
Warning
This installation may be unstable. If you're looking for a stable release, go here.
$ python -m pip install --upgrade git+https://github.com/ShineyDev/graphql.git@main
There is also a more in-depth installation guide in the documentation.
>>> import aiohttp
>>> import graphql
>>>
>>> session = aiohttp.ClientSession()
>>> client = graphql.client.Client(session=session, url="https://swapi-graphql.netlify.app/.netlify/functions/index/graphql")
>>>
>>> await client.request("{allPeople(first:3){edges{node{name}}}}")
{'allPeople': {'edges': [{'node': {'name': 'Luke Skywalker'}}, {'node': {'name': 'C-3PO'}}, {'node': {'name': 'R2-D2'}}]}}
There are also more in-depth usage guides in the documentation.