Skip to content

A simple graphql client which also supports file upload

License

Notifications You must be signed in to change notification settings

Bueffelheld/simple-graphql-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple GraphQL Client

Installation

The client is available on PyPI:

  • $ pip install simple-graphql-client

Usage

from simple_graphql_client import GraphQLClient

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

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

query = "..."

variables = {
    ...
}
data = client.query(query=query, variables=variables)
from simple_graphql_client import GraphQLClient

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

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

query = "..."
filename = "..."
variables = {
    ...
}

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

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

About

A simple graphql client which also supports file upload

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages