API Session Class
- class Session(headers, proxies=None, certificate_path=None, key_file_path=None, verify_ssl=False, tpp_version=None, connection_timeout=None, read_timeout=None)
Bases:
object
This class is responsible for holding the appropriate headers to authenticate each request. It also removes all null values from all data sent to TPP.
- Parameters
headers (dict) –
proxies (dict) –
certificate_path (str) –
key_file_path (str) –
verify_ssl (bool) –
tpp_version (Version) –
connection_timeout (float) –
read_timeout (float) –
- delete(url, params=None)
Sends a DELETE request to the given URL.
- Parameters
url (str) – URL endpoint
params (Optional[dict]) – Dictionary of parameters to append to the URL
- Returns
Returns the raw response returned by the server.
- get(url, params=None)
Sends a GET request to the given URL with the given URL parameters.
- Parameters
url (str) – URL endpoint
params (Optional[dict]) – Dictionary of parameters to append to the URL
- Returns
Returns the raw response returned by the server.
- post(url, data)
Sends a POST request to the given URL with the given data.
- Parameters
url (str) – URL endpoint
data (dict) – Dictionary of data
- Returns
Returns the raw response returned by the server.
- put(url, data)
Sends a PUT request to the given URL with the given data.
- Parameters
url (str) – URL endpoint
data (dict) – Dictionary of data
- Returns
Returns the raw response returned by the server.
- update_headers(new_headers)