Client

class universal_api_client.client.Client(base_url, auth=None, trailing_slash=True)

API client capable of generating requests

Parameters

  • base_url - Base url for the client.
  • auth - (optional) Authentication from the requests.auth package.
  • trailing_slash - (optional) Flag to define whether to put trailing slash at the end of the generated url.
request

Returns an instance of universal_api_client.request.APIRequest with base_url as starting url.

API Request

class universal_api_client.request.APIRequest(url, auth=None, trailing_slash=True)

URL builder and a thin wrapper around the requests library.

Parameters

  • url - Url for the request.
  • auth - (optional) Authentication from the requests.auth package.
  • trailing_slash - (optional) Flag to define whether to put trailing slash at the end of the generated url.
get(self, **kwargs)

Sends a GET request. Returns Response object.

Parameters

  • **kwargs - (optional) Optional arguments that request takes.
head(self, **kwargs)

Sends a HEAD request. Returns Response object.

Parameters

  • **kwargs - (optional) Optional arguments that request takes.
post(self, data=None, **kwargs)

Sends a POST request. Returns Response object.

Parameters

  • data - (optional) Dictionary, bytes, or file-like object to send in the body of the Request.
  • **kwargs - (optional) Optional arguments that request takes.
put(self, data=None, **kwargs)

Sends a PUT request. Returns Response object.

Parameters

  • data - (optional) Dictionary, bytes, or file-like object to send in the body of the Request.
  • **kwargs - (optional) Optional arguments that request takes.
patch(self, data=None, **kwargs)

Sends a PATCH request. Returns Response object.

Parameters

  • data - (optional) Dictionary, bytes, or file-like object to send in the body of the Request.
  • **kwargs - (optional) Optional arguments that request takes.
delete(self, **kwargs)

Sends a DELETE request. Returns Response object.

Parameters

  • **kwargs - (optional) Optional arguments that request takes.
options(self, **kwargs)

Sends a OPTIONS request. Returns Response object.

Parameters

  • **kwargs - (optional) Optional arguments that request takes.