https://github.com/qlient-org/python-qlient
A fast and modern graphql client designed with simplicity in mind.
https://github.com/qlient-org/python-qlient
api client graphql mutation python query rest
Last synced: 5 months ago
JSON representation
A fast and modern graphql client designed with simplicity in mind.
- Host: GitHub
- URL: https://github.com/qlient-org/python-qlient
- Owner: qlient-org
- License: mit
- Created: 2021-09-10T19:07:33.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-08-15T19:21:45.000Z (almost 4 years ago)
- Last Synced: 2024-04-24T13:55:56.780Z (about 2 years ago)
- Topics: api, client, graphql, mutation, python, query, rest
- Language: HTML
- Homepage: https://qlient-org.github.io/python-qlient/site/
- Size: 1 MB
- Stars: 45
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Qlient: Python GraphQL Client
[](https://deepsource.io/gh/qlient-org/python-qlient/?ref=repository-badge)
[](https://deepsource.io/gh/qlient-org/python-qlient/?ref=repository-badge)
[](https://pypi.python.org/pypi/qlient)
[](https://github.com/qlient-org/python-qlient)
[](https://github.com/qlient-org/python-qlient/blob/master/LICENSE)
[](https://github.com/psf/black)
A fast and modern graphql client designed with simplicity in mind.
## Key Features
* Compatible with Python 3.7 and above
* Build on top of
[qlient-core](https://github.com/qlient-org/python-qlient-core),
[requests](https://github.com/psf/requests)
and [websocket-client](https://github.com/websocket-client/websocket-client/)
* support for subscriptions
## Help
See [documentation](https://qlient-org.github.io/python-qlient/) for more details.
If you want more information about the internals,
I kindly refer you to the [qlient-core documentation](https://qlient-org.github.io/python-qlient-core/).
If you are looking for an asynchronous implementation,
I kindly refer you to the [qlient-aiohttp](https://github.com/qlient-org/python-qlient-aiohttp) sister project.
## Installation
```shell
pip install qlient
```
## Quick Start
````python
from qlient.http import HTTPClient, GraphQLResponse
client = HTTPClient("https://swapi-graphql.netlify.app/.netlify/functions/index")
res: GraphQLResponse = client.query.film(
# swapi graphql input fields
id="ZmlsbXM6MQ==",
# qlient specific
_fields=["id", "title", "episodeID"]
)
print(res.request.query) # query film($id: ID) { film(id: $id) { id title episodeID } }
print(res.request.variables) # {'id': 'ZmlsbXM6MQ=='}
print(res.data) # {'film': {'id': 'ZmlsbXM6MQ==', 'title': 'A New Hope', 'episodeID': 4}}
````