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.authpackage. - trailing_slash - (optional) Flag to define whether to put trailing slash at the end of the generated url.
requestReturns 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.authpackage. - 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
requesttakes.
head(self, **kwargs)Sends a HEAD request. Returns Response object.
Parameters
- **kwargs - (optional) Optional arguments that
requesttakes.
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
requesttakes.
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
requesttakes.
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
requesttakes.
delete(self, **kwargs)Sends a DELETE request. Returns Response object.
Parameters
- **kwargs - (optional) Optional arguments that
requesttakes.
options(self, **kwargs)Sends a OPTIONS request. Returns Response object.
Parameters
- **kwargs - (optional) Optional arguments that
requesttakes.