Skip to main content
🌐🐍 gql_py
-------

*GraphQL Client for Pythonistas*

gql_py is a Pythonic interface around graphQL APIs.

You've got a graphQL API, and you want to talk to it, right? For those of us who love HTTP standards, GraphQL's use of HTTP is questionable at best. The goal of this library is to remove the fuss of HTTP so you can deal with graphQL directly. Just how graphQL's developers intended.


.. image:: https://img.shields.io/pypi/v/gql_py.svg
:target: https://pypi.org/project/gql-py/

.. image:: https://img.shields.io/pypi/pyversions/gql_py.svg
:target: https://pypi.org/project/gql-py/

.. image:: https://img.shields.io/pypi/l/gql_py.svg
:target: https://pypi.org/project/gql-py/

.. image:: https://img.shields.io/pypi/status/gql_py.svg
:target: https://pypi.org/project/gql-py/

.. image:: https://circleci.com/gh/phalt/gql_py/tree/master.svg?style=svg
:target: https://circleci.com/gh/phalt/gql_py/tree/master

Installing the project is easy:

.. code-block:: bash

pip install gql_py

Full blown example:

.. code-block:: python

from gql_py import Gql

gql = Gql(api='https://example.com/graphql')

query = '''
query ($bookId: ID!) {
book(id: $bookId) {
id
title
author
}
}
'''

variables = {
'book_id': '654'
}

response = qgl.send(query=query, variables=variables)

response.ok
>>> True

response.errors
>>> None

response.data
>>> {'book': {'id': '654', 'title': 'Ursula K. Le Guin', 'title': 'A Wizard of Earthsea'}}


You can validate your graphql query string by passing the __validate__ flag in the __send__ method:

.. code-block:: python

gpl.send(query=query, validate=True)
>>> Traceback (most recent call last):
>>> graphql.error.syntax_error.GraphQLSyntaxError: Syntax Error: Expected Name, found }


📖 Features
--------

- No need to handle the HTTP layer. (You can still set HTTP headers, though!)
- Responses come back as named tuples - even errors!
- Validate your query strings easily.
- Python 3.6+

✨ Future goals
---------------

- Hydrate API responses into custom Python objects.

🏗 Status
----------

gql.py is currently under development.

🎥 Credits
-----------

This package was created with Cookiecutter_.

We use `Python Requests`_ for talking HTTP.

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`Python Requests`: https://github.com/audreyr/cookiecutter-pypackage


Release files for gql-py 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gql-py 0.6.0
File Size Uploaded
gql_py-0.6.0.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gql-py 0.6.0
File Interpreter ABI Platform
gql_py-0.6.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 10.1 kB

Release files / gql_py-0.6.0.tar.gz

Download URL gql_py-0.6.0.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b9eccbfd0ab23c1a976bbdefe80db21097b792e182ef34bcf51f3c135b9ab07d
BLAKE2b-256 checksum
How to use checksums
e58012c91651e2880aefc2c9007d1475348fd1b86f24be794f6315ec10644205
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.10.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

Release files / gql_py-0.6.0-py2.py3-none-any.whl

Download URL gql_py-0.6.0-py2.py3-none-any.whl
Size 5.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
dc0a8e2602c86f4b84adff93cbd384aa4728a7133334659090f388abad14e39d
BLAKE2b-256 checksum
How to use checksums
3fc93af1071dc81f94e20b4cae0130a3b3eb8b59db736974bf6c0fbf4f09c9a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.10.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.3.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page