{"id":15576539,"url":"https://github.com/abn/aiographql-client","last_synced_at":"2025-08-02T02:35:50.120Z","repository":{"id":39897294,"uuid":"172745330","full_name":"abn/aiographql-client","owner":"abn","description":"An asynchronous GraphQL client built on top of aiohttp and graphql-core-next","archived":false,"fork":false,"pushed_at":"2024-10-14T02:54:25.000Z","size":758,"stargazers_count":31,"open_issues_count":13,"forks_count":13,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-25T08:41:51.572Z","etag":null,"topics":["aiohttp-client","asyncio","graphql","graphql-core","hacktoberfest","python3"],"latest_commit_sha":null,"homepage":"https://aiographql-client.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-26T16:10:40.000Z","updated_at":"2025-07-11T04:58:17.000Z","dependencies_parsed_at":"2024-06-19T05:30:18.732Z","dependency_job_id":"b578e0c1-4655-4cb1-8753-8ec23be612cc","html_url":"https://github.com/abn/aiographql-client","commit_stats":{"total_commits":202,"total_committers":9,"mean_commits":"22.444444444444443","dds":0.5198019801980198,"last_synced_commit":"bcff7eb06c871eebe689463edf82926942b50c68"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/abn/aiographql-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abn%2Faiographql-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abn%2Faiographql-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abn%2Faiographql-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abn%2Faiographql-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abn","download_url":"https://codeload.github.com/abn/aiographql-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abn%2Faiographql-client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268082357,"owners_count":24192992,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aiohttp-client","asyncio","graphql","graphql-core","hacktoberfest","python3"],"created_at":"2024-10-02T18:51:18.636Z","updated_at":"2025-08-02T02:35:50.097Z","avatar_url":"https://github.com/abn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Asynchronous GraphQL Client\n[![PyPI version](https://badge.fury.io/py/aiographql-client.svg)](https://badge.fury.io/py/aiographql-client)\n[![Python Versions](https://img.shields.io/pypi/pyversions/aiographql-client)](https://pypi.org/project/aiographql-client/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Documentation Status](https://readthedocs.org/projects/aiographql-client/badge/?version=latest)](https://aiographql-client.readthedocs.io/en/latest/?badge=latest)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Sonarcloud Status](https://sonarcloud.io/api/project_badges/measure?project=abn_aiographql-client\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=abn_aiographql-client)\n[![](https://github.com/abn/aiographql-client/workflows/Test%20Suite/badge.svg)](https://github.com/abn/aiographql-client/actions?query=workflow%3A%22Test+Suite%22)\n\nAn asynchronous GraphQL client built on top of aiohttp and graphql-core-next. The client by default introspects schemas and validates all queries prior to dispatching to the server.\n\n## Documentation\n\nFor the most recent project documentation, you can visit https://aiographql-client.readthedocs.io/.\n\n## Installation\n`pip install aiographql-client`\n\n## Example Usage\nHere are some example usages of this client implementation. For more examples, and advanced scenarios,\nsee [Usage Examples](https://aiographql-client.readthedocs.io/en/latest/examples.html) section in\nthe documentation.\n\n### Simple Query\n```py\nasync def get_logged_in_username(token: str) -\u003e GraphQLResponse:\n    client = GraphQLClient(\n        endpoint=\"https://api.github.com/graphql\",\n        headers={\"Authorization\": f\"Bearer {token}\"},\n    )\n    request = GraphQLRequest(\n        query=\"\"\"\n            query {\n              viewer {\n                login\n              }\n            }\n        \"\"\"\n    )\n    return await client.query(request=request)\n```\n\n```console\n\u003e\u003e\u003e import asyncio\n\u003e\u003e\u003e response = asyncio.run(get_logged_in_username(\"\u003cTOKEN FROM GITHUB GRAPHQL API\u003e\"))\n\u003e\u003e\u003e response.data\n{'viewer': {'login': 'username'}}\n```\n\n### Query Subscription\n```py\nasync def print_city_updates(client: GraphQLClient, city: str) -\u003e None:\n    request = GraphQLRequest(\n        query=\"\"\"\n            subscription ($city:String!) {\n              city(where: {name: {_eq: $city}}) {\n                description\n                id\n              }\n            }\n        \"\"\",\n        variables={\"city\": city},\n    )\n    # subscribe to data and error events, and print them\n    await client.subscribe(\n        request=request, on_data=print, on_error=print, wait=True\n    )\n```\n\nFor custom event specific callback registration, see [Callback Registry Documentation](https://aiographql-client.readthedocs.io/en/latest/examples.html#callback-registry).\n\n### Query Validation Failures\nIf your query is invalid, thanks to graphql-core-next, we get a detailed exception in the traceback.\n\n```\naiographql.client.exceptions.GraphQLClientValidationException: Query validation failed\n\nCannot query field 'ids' on type 'chatbot'. Did you mean 'id'?\n\nGraphQL request (4:13)\n3:           chatbot {\n4:             ids, bot_names\n               ^\n5:           }\n\nCannot query field 'bot_names' on type 'chatbot'. Did you mean 'bot_name' or 'bot_language'?\n\nGraphQL request (4:18)\n3:           chatbot {\n4:             ids, bot_names\n                    ^\n5:           }\n\n```\n\n### Query Variables \u0026 Operations\nSupport for multi-operation requests and variables is available via the client. For example,\nthe following request contains multiple operations. The instance specifies default values to use.\n\n```py\nrequest = GraphQLRequest(\n    query=\"\"\"\n    query get_bot_created($id: Int) {\n      chatbot(where: {id: {_eq: $id}}) {\n        id, created\n      }\n    }\n    query get_bot_name($id: Int) {\n      chatbot(where: {id: {_eq: $id}}) {\n        id, bot_name\n      }\n    }\n    \"\"\",\n    variables={\"id\": 109},\n    operation=\"get_bot_name\"\n)\n```\n\nThe default values can be overridden at the time of making the request if required.\n\n```py\nawait client.query(request=request, variables={\"id\": 20}, operation=\"get_bot_created\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabn%2Faiographql-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabn%2Faiographql-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabn%2Faiographql-client/lists"}