Getting started

This package is intended to be used as a client library for when your application requires interacting with a GraphQL server.

Getting started is as simple as passing your GraphQL query to aiographql.client.GraphQLClient.query().

async def get_logged_in_username(token: str) -> GraphQLResponse:
    client = GraphQLClient(
        endpoint="https://api.github.com/graphql",
        headers={"Authorization": f"Bearer {token}"},
    )
    return await client.query("query { viewer { login } }")

For more detailed examples on how to use the library, see Usage Examples.

Hint

The JS GraphQL plugin allows for easier working with GraphQL and also adds auto-complete during development.

Adding to your project

You can add the the package to your project by specifying a dependency to aiographql-client.

If you are using Poetry to manage your project, the following command should do the trick.

poetry add aiographql-client

When using pip you can do the following.

pip install aiographql-client