preheat_open.api.session.ApiSession
- class preheat_open.api.session.ApiSession(config=None)
Bases:
objectClass to handle API connection sessions
- __init__(config=None)
Methods
__init__([config])close()Method to close the session
delete([endpoint, params])Method to send a DELETE request to the API
get([endpoint, out, params])Method to send a GET request to the API
patch([endpoint, out, json_body, params])Method to send a PATCH request to the API
post([endpoint, out, json_body, params])Method to send a POST request to the API
put([endpoint, out, json_body, params])Method to send a PUT request to the API
- close()
Method to close the session
- delete(endpoint='', params=None)
Method to send a DELETE request to the API
- Parameters:
endpoint (
str) – URL of the endpointparams (
Optional[dict[str,Any]]) – params for the request
- Return type:
Response- Returns:
API response in request.Response format
- get(endpoint='', out='json', params=None)
Method to send a GET request to the API
- Parameters:
endpoint (
str) – URL of the endpointout (
str) – output type (json or csv)params (
Optional[dict[str,Any]]) – params for the request
- Returns:
API response in request.Response format
- patch(endpoint='', out='json', json_body=None, params=None)
Method to send a PATCH request to the API
- Parameters:
endpoint (
str) – URL of the endpointout (
str) – output type (json or csv)json_payload – payload for the request
timeout – timeout (in seconds) for the call - defaults to PUT_TIMEOUT_SECONDS
- Return type:
Response- Returns:
API response in request.Response format
- post(endpoint='', out='json', json_body=None, params=None)
Method to send a POST request to the API
- Parameters:
endpoint (
str) – URL of the endpointout (
str) – output type (json or csv)json_payload – payload for the request
timeout – timeout (in seconds) for the call - defaults to PUT_TIMEOUT_SECONDS
- Return type:
Response- Returns:
API response in request.Response format
- put(endpoint='', out='json', json_body=None, params=None)
Method to send a PUT request to the API
- Parameters:
endpoint (
str) – URL of the endpointout (
str) – output type (json or csv)json – payload for the request
params (
Optional[dict[str,Any]]) – params for the request
- Return type:
Response- Returns:
API response in request.Response format