polarion_rest_api_client.open_api_client package

A client library for accessing Polarion REST API

class polarion_rest_api_client.open_api_client.AuthenticatedClient(base_url: str, token: str, prefix: str = 'Bearer', auth_header_name: str = 'Authorization', *, raise_on_unexpected_status: bool = False, cookies: dict[str, str] = NOTHING, headers: dict[str, str] = NOTHING, timeout: Timeout | None = None, verify_ssl: str | bool | SSLContext = True, follow_redirects: bool = False, httpx_args: dict[str, Any] = NOTHING)

Bases: object

A Client which has been authenticated for use on secured endpoints

The following are accepted as keyword arguments and will be used to construct httpx Clients internally:

base_url: The base URL for the API, all requests are made to a relative path to this URL

cookies: A dictionary of cookies to be sent with every request

headers: A dictionary of headers to be sent with every request

timeout: The maximum amount of a time a request can take. API functions will raise httpx.TimeoutException if this is exceeded.

verify_ssl: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes.

follow_redirects: Whether or not to follow redirects. Default value is False.

httpx_args: A dictionary of additional arguments to be passed to the httpx.Client and httpx.AsyncClient constructor.

Attributes:
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a

status code that was not documented in the source OpenAPI document. Can also be provided as a keyword argument to the constructor.

token: The token to use for authentication prefix: The prefix to use for the Authorization header auth_header_name: The name of the Authorization header

auth_header_name: str
get_async_httpx_client() → AsyncClient

Get the underlying httpx.AsyncClient, constructing a new one if not previously set

get_httpx_client() → Client

Get the underlying httpx.Client, constructing a new one if not previously set

prefix: str
raise_on_unexpected_status: bool
set_async_httpx_client(async_client: AsyncClient) → AuthenticatedClient

Manually set the underlying httpx.AsyncClient

NOTE: This will override any other settings on the client, including cookies, headers, and timeout.

set_httpx_client(client: Client) → AuthenticatedClient

Manually set the underlying httpx.Client

NOTE: This will override any other settings on the client, including cookies, headers, and timeout.

token: str
with_cookies(cookies: dict[str, str]) → AuthenticatedClient

Get a new client matching this one with additional cookies

with_headers(headers: dict[str, str]) → AuthenticatedClient

Get a new client matching this one with additional headers

with_timeout(timeout: Timeout) → AuthenticatedClient

Get a new client matching this one with a new timeout configuration

class polarion_rest_api_client.open_api_client.Client(base_url: str, *, raise_on_unexpected_status: bool = False, cookies: dict[str, str] = NOTHING, headers: dict[str, str] = NOTHING, timeout: Timeout | None = None, verify_ssl: str | bool | SSLContext = True, follow_redirects: bool = False, httpx_args: dict[str, Any] = NOTHING)

Bases: object

A class for keeping track of data related to the API

The following are accepted as keyword arguments and will be used to construct httpx Clients internally:

base_url: The base URL for the API, all requests are made to a relative path to this URL

cookies: A dictionary of cookies to be sent with every request

headers: A dictionary of headers to be sent with every request

timeout: The maximum amount of a time a request can take. API functions will raise httpx.TimeoutException if this is exceeded.

verify_ssl: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes.

follow_redirects: Whether or not to follow redirects. Default value is False.

httpx_args: A dictionary of additional arguments to be passed to the httpx.Client and httpx.AsyncClient constructor.

Attributes:
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a

status code that was not documented in the source OpenAPI document. Can also be provided as a keyword argument to the constructor.

get_async_httpx_client() → AsyncClient

Get the underlying httpx.AsyncClient, constructing a new one if not previously set

get_httpx_client() → Client

Get the underlying httpx.Client, constructing a new one if not previously set

raise_on_unexpected_status: bool
set_async_httpx_client(async_client: AsyncClient) → Client

Manually set the underlying httpx.AsyncClient

NOTE: This will override any other settings on the client, including cookies, headers, and timeout.

set_httpx_client(client: Client) → Client

Manually set the underlying httpx.Client

NOTE: This will override any other settings on the client, including cookies, headers, and timeout.

with_cookies(cookies: dict[str, str]) → Client

Get a new client matching this one with additional cookies

with_headers(headers: dict[str, str]) → Client

Get a new client matching this one with additional headers

with_timeout(timeout: Timeout) → Client

Get a new client matching this one with a new timeout configuration

Subpackages

Submodules

polarion_rest_api_client.open_api_client.client module

class polarion_rest_api_client.open_api_client.client.AuthenticatedClient(base_url: str, token: str, prefix: str = 'Bearer', auth_header_name: str = 'Authorization', *, raise_on_unexpected_status: bool = False, cookies: dict[str, str] = NOTHING, headers: dict[str, str] = NOTHING, timeout: Timeout | None = None, verify_ssl: str | bool | SSLContext = True, follow_redirects: bool = False, httpx_args: dict[str, Any] = NOTHING)

Bases: object

A Client which has been authenticated for use on secured endpoints

The following are accepted as keyword arguments and will be used to construct httpx Clients internally:

base_url: The base URL for the API, all requests are made to a relative path to this URL

cookies: A dictionary of cookies to be sent with every request

headers: A dictionary of headers to be sent with every request

timeout: The maximum amount of a time a request can take. API functions will raise httpx.TimeoutException if this is exceeded.

verify_ssl: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes.

follow_redirects: Whether or not to follow redirects. Default value is False.

httpx_args: A dictionary of additional arguments to be passed to the httpx.Client and httpx.AsyncClient constructor.

Attributes:
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a

status code that was not documented in the source OpenAPI document. Can also be provided as a keyword argument to the constructor.

token: The token to use for authentication prefix: The prefix to use for the Authorization header auth_header_name: The name of the Authorization header

auth_header_name: str
get_async_httpx_client() → AsyncClient

Get the underlying httpx.AsyncClient, constructing a new one if not previously set

get_httpx_client() → Client

Get the underlying httpx.Client, constructing a new one if not previously set

prefix: str
raise_on_unexpected_status: bool
set_async_httpx_client(async_client: AsyncClient) → AuthenticatedClient

Manually set the underlying httpx.AsyncClient

NOTE: This will override any other settings on the client, including cookies, headers, and timeout.

set_httpx_client(client: Client) → AuthenticatedClient

Manually set the underlying httpx.Client

NOTE: This will override any other settings on the client, including cookies, headers, and timeout.

token: str
with_cookies(cookies: dict[str, str]) → AuthenticatedClient

Get a new client matching this one with additional cookies

with_headers(headers: dict[str, str]) → AuthenticatedClient

Get a new client matching this one with additional headers

with_timeout(timeout: Timeout) → AuthenticatedClient

Get a new client matching this one with a new timeout configuration

class polarion_rest_api_client.open_api_client.client.Client(base_url: str, *, raise_on_unexpected_status: bool = False, cookies: dict[str, str] = NOTHING, headers: dict[str, str] = NOTHING, timeout: Timeout | None = None, verify_ssl: str | bool | SSLContext = True, follow_redirects: bool = False, httpx_args: dict[str, Any] = NOTHING)

Bases: object

A class for keeping track of data related to the API

The following are accepted as keyword arguments and will be used to construct httpx Clients internally:

base_url: The base URL for the API, all requests are made to a relative path to this URL

cookies: A dictionary of cookies to be sent with every request

headers: A dictionary of headers to be sent with every request

timeout: The maximum amount of a time a request can take. API functions will raise httpx.TimeoutException if this is exceeded.

verify_ssl: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes.

follow_redirects: Whether or not to follow redirects. Default value is False.

httpx_args: A dictionary of additional arguments to be passed to the httpx.Client and httpx.AsyncClient constructor.

Attributes:
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a

status code that was not documented in the source OpenAPI document. Can also be provided as a keyword argument to the constructor.

get_async_httpx_client() → AsyncClient

Get the underlying httpx.AsyncClient, constructing a new one if not previously set

get_httpx_client() → Client

Get the underlying httpx.Client, constructing a new one if not previously set

raise_on_unexpected_status: bool
set_async_httpx_client(async_client: AsyncClient) → Client

Manually set the underlying httpx.AsyncClient

NOTE: This will override any other settings on the client, including cookies, headers, and timeout.

set_httpx_client(client: Client) → Client

Manually set the underlying httpx.Client

NOTE: This will override any other settings on the client, including cookies, headers, and timeout.

with_cookies(cookies: dict[str, str]) → Client

Get a new client matching this one with additional cookies

with_headers(headers: dict[str, str]) → Client

Get a new client matching this one with additional headers

with_timeout(timeout: Timeout) → Client

Get a new client matching this one with a new timeout configuration

polarion_rest_api_client.open_api_client.errors module

Contains shared errors types that can be raised from API functions

exception polarion_rest_api_client.open_api_client.errors.UnexpectedStatus(status_code: int, content: bytes)

Bases: Exception

Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True

polarion_rest_api_client.open_api_client.types module

Contains some shared types for properties

class polarion_rest_api_client.open_api_client.types.File(payload: BinaryIO, file_name: str | None = None, mime_type: str | None = None)

Bases: object

Contains information for file uploads

file_name: str | None
mime_type: str | None
payload: BinaryIO
to_tuple() → tuple[str | None, IO[bytes] | bytes | str, str | None] | tuple[str | None, IO[bytes] | bytes | str, str | None, Mapping[str, str]]

Return a tuple representation that httpx will accept for multipart/form-data

class polarion_rest_api_client.open_api_client.types.Response(status_code: HTTPStatus, content: bytes, headers: MutableMapping[str, str], parsed: T | None)

Bases: Generic

A response from an endpoint

content: bytes
headers: MutableMapping[str, str]
parsed: T | None
status_code: HTTPStatus
class polarion_rest_api_client.open_api_client.types.Unset

Bases: object