Pyxis Session

Class used for maintaining authentication credentials and various configuration options such as retries.

Instance of this class is used as a parameter for ‘apply_to_session’ authentication method.

class pubtools._pyxis.pyxis_session.PyxisSession(hostname: str, retries: int = 5, backoff_factor: int = 5, verify: bool = False)[source]

Helper class to support Pyxis requests and authentication.

__init__(hostname: str, retries: int = 5, backoff_factor: int = 5, verify: bool = False) None[source]

Initialize.

Args:
hostname (str)

hostname of Pyxis service.

retries (int)

number of http retries.

backoff_factor (int)

backoff factor to apply between attempts after the second try.

verify (bool)

enable/disable SSL CA verification.

get(endpoint: str, **kwargs: Any) Response[source]

HTTP GET request against Pyxis server API.

Args:

endpoint (str): Endpoint of the request. **kwargs: Additional arguments to add to the requests method.

Returns:

requests.Response: A response object.

post(endpoint: str, **kwargs: Any) Response[source]

HTTP POST request against Pyxis server API.

Args:

endpoint (str): Endpoint of the request. **kwargs: Additional arguments to add to the requests method.

Returns:

requests.Response: A response object.

put(endpoint: str, **kwargs: Any) Response[source]

HTTP PUT request against Pyxis server API.

Args:

endpoint (str): Endpoint of the request. **kwargs: Additional arguments to add to the requests method.

Returns:

requests.Response: A response object.

delete(endpoint: str, **kwargs: Any) Response[source]

HTTP DELETE request against Pyxis server API.

Args:

endpoint (str): Endpoint of the request. **kwargs: Additional arguments to add to the requests method.

Returns:

requests.Response: A response object.

_api_url(endpoint: str) str[source]

Generate full url of the API endpoint.

Args:
endpoint (str)

API specific endpoint for the request.

Returns:

str: Full URL of the endpoint.