kirjava.utilities

Useful functions.

kirjava.utilities.create_response_error_message(response)[source]

Works out what to say about a response that isn’t JSON.

Parameters

response – The HTTP response object.

Return type

str

kirjava.utilities.execute(url, *args, headers=None, **kwargs)[source]

Sends a GraphQL request without the user haveing to make a dedicated Client object.

Parameters
  • url (str) – the URL to send to.

  • message (str) – The query to make.

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

  • headers (dict) – Any additional HTTP headers.

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

Return type

dict

kirjava.utilities.get_files_from_variables(variables)[source]

Takes a variables objects and looks to see if any of the values are file objects which need to be sent separately.

Parameters

variables (dict) – the variables to inspect, or None.

Returns

(variables, files)