python-graphql-client
Python GraphQL Client
What it is and what it does
python-graphql-client is a lightweight wrapper around aiohttp, requests, and websockets that simplifies making GraphQL requests to a remote server. It handles query and mutation execution in both synchronous and asynchronous modes, and supports real-time subscriptions over WebSocket. You instantiate a client with a GraphQL endpoint URL, then call execute() or execute_async() to send queries with variables, or subscribe() to listen for subscription events. The package abstracts away HTTP headers, request formatting, and WebSocket connection management, letting you focus on writing GraphQL operations.
The library is straightforward and minimal—it does not include schema introspection, caching, or request batching. It's designed for developers who want a simple way to call a GraphQL API from Python without pulling in a large framework. The aging maintenance status (last release in 2021) means it may not track the latest GraphQL spec changes or server features, though the core request/response pattern remains stable.
Use it for:
- Query a public GraphQL API (e.g., GitHub, Shopify) to fetch data in a Python script or application
- Execute mutations asynchronously to update remote data without blocking the main thread
- Subscribe to real-time GraphQL events over WebSocket and handle streaming updates
- Build a Python backend that proxies or aggregates calls to one or more GraphQL services
- Test a GraphQL server during development by sending queries and assertions from Python
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Sends GraphQL queries, mutations, and subscriptions to a GraphQL server using synchronous or asynchronous requests over HTTP or WebSocket.
Yes, if you need a simple synchronous or asynchronous GraphQL client and don't require advanced features like caching or introspection. The aging maintenance (last release 2021) is a minor concern—the core HTTP and WebSocket request patterns are stable—but be aware that newer GraphQL server features or spec changes may not be supported. No known vulnerabilities. Low install friction and permissive license make it a low-risk choice for straightforward GraphQL consumption.
Install
python-graphql-client on PyPI
pip
pip install python-graphql-clientuv
uv add python-graphql-clientpoetry
poetry add python-graphql-clientInstalling python-graphql-client
Before you install
Low install friction with a pure Python wheel. Maintenance is aging—last release was 2021-03-04, over four years old, though the repository remains active with recent commits as of 2025-07-21. Depends on aiohttp, requests, and websockets, all mature and widely used.
License in practice
MIT license (permissive) means you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install python-graphql-client
from python_graphql_client import GraphqlClient
client = GraphqlClient(endpoint="https://countries.trevorblades.com")
query = "query countryQuery($countryCode: String) { country(code:$countryCode) { code name } }"
data = client.execute(query=query, variables={"countryCode": "CA"})
Verify before relying
- Whether the package works reliably with modern Python versions beyond 3.8, given classifiers list only up to 3.8
- Current test coverage and whether breaking changes exist between 0.4.3 and the latest GraphQL server implementations
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — aiohttp, requests, websockets |
| Maintenance | aging — 1,989 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 654,036/month — #5,530 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python_graphql_client-0.4.3-py3-none-any.whl
Keywords: api, graphql, client
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
devo-sdkSend events and files to Devo, query data via…
permissive · top 15,000 on PyPI
django-graphql-jwtAdds JSON Web Token (JWT) authentication to…
permissive · top 15,000 on PyPI
gqlA GraphQL client for Python that executes…
permissive · top 1,000 on PyPI
graphqlclientA lightweight GraphQL client that sends queries…
permissive · top 15,000 on PyPI
pydgraphOfficial Python client for Dgraph, a…
permissive · top 15,000 on PyPI
sgqlcsgqlc is a Python client library for querying…
permissive · top 5,000 on PyPI
ariadne-codegenGenerates fully typed, asynchronous Python…
permissive · top 5,000 on PyPI
Flask-GraphQLAdds a GraphQL endpoint to Flask applications,…
permissive · top 15,000 on PyPI
graphql-serverGraphQL-Server provides helper functions to…
permissive · top 15,000 on PyPI
python-gitlabPython wrapper for GitLab's REST and GraphQL…
copyleft · top 5,000 on PyPI