patroni.request module

Facilities for handling communication with Patroni’s REST API.

class _patroni.request.HTTPSConnectionPool(_host: str, port: int | None = None, timeout: _TYPE_TIMEOUT | None = _TYPE_DEFAULT.token, maxsize: int = 1, block: bool = False, headers: Mapping[ str, str] | None = None, retries: Retry | bool | int | None = None, __proxy: Url | None = None_, \__proxy_headers: Mapping[ str, str] | None = None_, key_file: str | None = None, cert_file: str | None = None, cert_reqs: int | str | None = None, key_password: str | None = None, ca_certs: str | None = None, ssl_version: int | str | None = None, ssl_minimum_version: ssl.TLSVersion | None = None, ssl_maximum_version: ssl.TLSVersion | None = None, assert_hostname: str | Literal[False] | None = None, assert_fingerprint: str | None = None, ca_cert_dir: str | None = None, **conn_kw: Any) View on GitHub

Bases: HTTPSConnectionPool +

validate_conn(*args: Any, _**kwargs: Any) → None View on GitHub

Override parent method to silence warnings about requests without certificate verification enabled.

class _patroni.request.PatroniPoolManager(*args: Any, _**kwargs: Any) View on GitHub

Bases: PoolManager +

__init\\__(*args: Any, **kwargs: Any) → None View on GitHub
class _patroni.request.PatroniRequest(_config: Config | Dict[ str, Any], insecure: bool | None = None) View on GitHub

Bases: object + Wrapper for performing requests to Patroni’s REST API. + Prepares the request manager with the configured settings before performing the request. +

__init\\__(config: Config | Dict[ str, Any], insecure: bool | None = None) → None View on GitHub

Create a new PatroniRequest instance with given config. +

Parameters

+

apply_pool_param(_param: str, value: Any) → None View on GitHub

Configure param as value in the request manager. +

Parameters

+

apply_ssl_file_param(_config: Config | Dict[ str, Any], name: str) → str | None View on GitHub

Apply a given SSL related param to the request manager. +

Parameters

Will attempt to fetch the requested key first from ctl section.

Returns

value of ctl.*name*file if present, None otherwise. +

static \\__get_ctl_value(_config: Config | Dict[ str, Any], name: str, default: Any = None) → Any | None View on GitHub

Get value of name setting from the ctl section of the config. +

Parameters
Returns

value of ctl.*name* if present, None otherwise. +

static \\__get_restapi_value(_config: Config | Dict[ str, Any], name: str) → Any | None View on GitHub

Get value of name setting from the restapi section of the config. +

Parameters
Returns

value of restapi`+ ``→`` ``name` if present, `+None` otherwise. +

reload_config(config: Config | Dict[ str, Any]) → None View on GitHub

Apply config to request manager. + Configure these HTTP headers for requests: + __\\__ __\\__ + Also configure SSL related settings for requests: + __\\__ __\\__ +

Parameters

config – Patroni YAML configuration. +

request(method: str, url: str, body: Any | None = None, **kwargs: Any) → HTTPResponse View on GitHub

Perform an HTTP request. +

Parameters
Returns

the response returned upon request.

patroni.request.get(url: str, verify: bool = True, **kwargs: Any) → HTTPResponse View on GitHub

Perform an HTTP GET request. + Note

It uses link:#patroni.request.PatroniRequest[`+PatroniRequest+`] so all relevant configuration is applied before processing the request.
+
Parameters:;;
Returns:;;
  the response returned from the request.

© Copyright 2015 Compose, Zalando SE. Revision 9d231aee.

Built with Sphinx using a theme provided by Read the Docs.

Read the Docs v: latest

+ Builds