Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 807 Bytes

README.md

File metadata and controls

40 lines (30 loc) · 807 Bytes

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)