Quay Session

This is a helper class used by Quay API Client and Quay Client and used primarily for holding a session and not requiring authentication for each query.

class pubtools._quay.quay_session.QuaySession(hostname: Optional[str] = None, retries: int = 3, backoff_factor: int = 2, verify: bool = False, api: str = 'docker')[source]

Helper class to support Quay requests and authentication.

__init__(hostname: Optional[str] = None, retries: int = 3, backoff_factor: int = 2, verify: bool = False, api: str = 'docker') None[source]

Initialize.

Args:
hostname (str)

hostname of Quay 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.

api (str):

Which API queries to construct. Supported values: ‘docker’, ‘quay’

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

HTTP GET request against Quay 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 Quay 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 Quay 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 Quay server API.

Args:
endpoint (str):

Endpoint of the request.

kwargs:

Additional arguments to add to the requests method.

Returns:

requests.Response: A response object.

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

HTTP generic request against Quay server API.

Args:
method (str):

REST API method of the request (GET, POST, PUT, DELETE).

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.

set_auth_token(token: str) None[source]

Set a Bearer auth token for the authentication.

Args:
token (str):

Bearer token.