API Client

class koordinates.client.Client(host, token=None, activate_logging=False)

Bases: object

A Client is used to define the host and api-version which the user wants to connect to. The user identity is also defined when Client is instantiated.

get_manager(model)

Return the active manager for the given model. :param model: Model class to look up the manager instance for. :return: Manager instance for the model associated with this client.

get_url(datatype, verb, urltype, params={}, api_host=None, api_version=None)

Returns a fully formed url

Parameters:
  • datatype – a string identifying the data the url will access.
  • verb – the HTTP verb needed for use with the url.
  • urltype – an adjective used to the nature of the request.
  • **params – substitution variables for the URL.
Returns:

string

Return type:

A fully formed url.

reverse_url(datatype, url, verb='GET', urltype='single', api_version=None)

Extracts parameters from a populated URL

Parameters:
  • datatype – a string identifying the data the url accesses.
  • url – the fully-qualified URL to extract parameters from.
  • verb – the HTTP verb needed for use with the url.
  • urltype – an adjective used to the nature of the request.
Returns:

dict