kirjava.client

Contains the Client class itself.

class kirjava.client.Client(url)[source]

A GraphQL client. This is the object which sends requests to the GraphQL server.

The URL that serves the GraphQL content is given on creating the Client.

Parameters
  • url (str) – The URL of the GraphQL server to interact with.

  • headers (dict) – Any additional HTTP headers.

execute(message, method='POST', variables=None)[source]

Sends a request to the GraphQL server.

Parameters
  • message (str) – The query to make.

  • method (str) – By default, POST requests are sent, but this can be overriden here.

  • variables (dict) – Any GraphQL variables can be passed here.

Return type

dict

property headers

The HTTP headers that will be sent with every request.

Return type

dict

property history

The queries sent, most recent first.

Return type

tuple

property url

The URL of the GraphQL server to interact with.

Return type

str