Skip to content

qlient-org/python-qlient-aiohttp

Repository files navigation

Qlient AIOHTTP: Python GraphQL Client

DeepSource DeepSource pypi versions license

A blazingly fast and modern graphql client based on qlient-core and aiohttp

Key Features

  • Compatible with Python 3.7 and above
  • Build on top of qlient-core and aiohttp
  • support for subscriptions

Help

See the documentation for more details.

Quick Preview

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=="
  }
}

About

The official aiohttp qlient implementation

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •