Skip to main content

Simple GraphQL Client

Installation

The client is available on PyPI:

  • $ pip install simple-graphql-client

Examples

Executing a query

from simple_graphql_client import GraphQLClient

headers = {'Authorization': 'Bearer ...'}

client = GraphQLClient("https://...", headers=headers)

query = "..."

variables = {
    ...
}
data = client.query(query=query, variables=variables)

Executing a query with a single file

Note: For information visit: https://github.com/jaydenseric/graphql-multipart-request-spec

from simple_graphql_client import GraphQLClient

headers = {'Authorization': 'Bearer ...'}

client = GraphQLClient("https://...", headers=headers)

query = "..."
filename = "..."
variables = {
    ...
    'file': None,
    ...
}

with open(filename, "rb") as file:
    files = [
        ('file', (filename, file))
    ]

    response = client.query_with_files(query=query, variables=variables, files=files)

Executing a query with a multiple files

from simple_graphql_client import GraphQLClient

client = GraphQLClient("https://...")

query = "..."
filenames = ["...", "..."]
files = []
variables = {
    ...
    'files': [None, None]
    ... 
}

for i, filename in enumerate(filenames):
    variable = 'files.{}'.format(i)
    files.append((variable, (filename, open(filename, "rb"))))

response = client.query_with_files(query=query, variables=variables, files=files)

Setting a query-specific header

This argument will override the default header which can be set in the GraphQLClient

response = client.query(query=query, variables=variables, files=files, headers=headers)
response = client.query_with_files(query=query, variables=variables, files=files, headers=headers)

Metadata

Release files for simple-graphql-client 0.0.4

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

Source distribution (sdist)

Source distribution for simple-graphql-client 0.0.4
File Size Uploaded Provenance Actions
simple-graphql-client-0.0.4.tar.gz 3.2 kB Without provenance Details for simple-graphql-client-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for simple-graphql-client 0.0.4
File Interpreter ABI Platform Actions
simple_graphql_client-0.0.4-py3-none-any.whl Python 3 none any Details for simple_graphql_client-0.0.4-py3-none-any.whl

Total release size: 7.8 kB

Release files / simple-graphql-client-0.0.4.tar.gz

Download URL simple-graphql-client-0.0.4.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1db213477b79e317a55cb918a0ededf033ae0aa2a0db0f5b4d6f178b1643e185
BLAKE2b-256 checksum
How to use checksums
3837614c57ecbec83e3859243a23e78853e6af51ffacc07235bc0087dd9d5fa2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

Release files / simple_graphql_client-0.0.4-py3-none-any.whl

Download URL simple_graphql_client-0.0.4-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cdcfd857e8840948ed3c3663ca86fd8eb4548d14bdd2c0ad8ff5e731b4c03084
BLAKE2b-256 checksum
How to use checksums
a4e248971a22648c42acf00664ee2bd15a83f8349550dff224c4f39c3df4d989
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

Security for simple-graphql-client 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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