Session
Define a session to communicate with StArMap over HTTPS.
Interface
-
class starmap_client.session.StarmapBaseSession[source]
Define the interface for the Starmap’s session objects.
-
abstract get(path, **kwargs)[source]
Perform a GET request on StArMap.
- Return type:
Response
-
abstract post(path, json, **kwargs)[source]
Perform a POST request on StArMap.
- Return type:
Response
-
abstract put(path, json, **kwargs)[source]
Perform a PUT request on StArMap.
- Return type:
Response
Implementations
Network based (Online)
-
class starmap_client.session.StarmapSession(url, api_version, retries=3, backoff_factor=2.0)[source]
Implement a HTTP(S) session with StArMap.
-
__init__(url, api_version, retries=3, backoff_factor=2.0)[source]
Create the StarmapSession object.
- Parameters:
url (str) – The StArMap server endpoint base URL
api_version (str
) – The StArMap server API version to call
retries (int, optional) – The number of request retries on failure
backoff_factor (float, optional) – The backoff factor to apply between attempts after the second try
-
get(path, **kwargs)[source]
Perform a GET request on StArMap.
- Return type:
Response
-
post(path, json, **kwargs)[source]
Perform a POST request on StArMap.
- Return type:
Response
-
put(path, json, **kwargs)[source]
Perform a PUT request on StArMap.
- Return type:
Response
Mock based (Offline)
-
class starmap_client.session.StarmapMockSession(url, api_version, status_code=404, json_data=None)[source]
Implement a mock session with predefined responses.
-
__init__(url, api_version, status_code=404, json_data=None)[source]
Create the StarmapMockSession object.
- Parameters:
url (str) – The mock server endpoint base URL
api_version (str
) – The mock server API version to call
status_code (optional, int) – The status code to return on each request
json_data (optional, any) – The JSON data to return on each request
-
register_uri(method, uri)[source]
Register an URI into the requests_mock
adapter.
- Parameters:
-