skillfed

python-graphql-client

Python GraphQL Client

python-graphql-client v0.4.3 654.0K downloads/30d#5,530 on PyPI81
Permissive license MIT AGING released

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-client

uv

uv add python-graphql-client

poetry

poetry add python-graphql-client

Installing 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

Development Status :: 3 - AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Topic :: Software Development :: Libraries

Tags

graphql client pythongraphql query requestsgraphql mutations asyncgraphql subscriptions websocketgraphql api clientsend graphql queries python
graphqlapi-clientasync-support

More Libraries packages