Package API: konnect.curl

exception CurlError(code: int, msg: str)[source]

Bases: Exception

An error exception for Curl transfers

The value of ‘code’ is a Curl CURLE_* value, for instance CURLE_COULDNT_CONNECT. The value of ‘msg’ is an error message returned by curl_easy_strerror with ‘code’ passed as an argument.

property code: int
property msg: str
class Multi[source]

Bases: object

A wrapper around CurlMulti to bind it with Anyio-supported event frameworks

Users should treat this class as a black-box. Only the Multi.process(), Multi.get_send_stream() and Multi.get_receive_stream() methods are available. There are no other methods or attributes they should attempt to call or override as doing so will have undefined results.

async process(request: Request) → UpdateT | ResultT[source]

Perform a request as described by a Curl instance

get_send_stream(request: Request) → ByteSendStream[source]

Return a writable bytes stream for the upload portion of a transfer

The returned stream object implements ByteSendStream.

get_receive_stream(request: Request) → ByteReceiveStream[source]

Return a readable bytes stream for the download portion of a transfer

The returned stream object implements ByteReceiveStream.

class Time(*values)[source]

Bases: QuantityUnit

Units for time intervals

MILLISECONDS = 1
SECONDS = 1000
class Url(_src: str, /)[source]

Bases: str

URL strings that can be examined and manipulated

scheme: str
hostname: str
port: int | None
path: str
query: list[tuple[str, str]]
fragment: str
netloc: str
username: str | None
password: str | None
classmethod from_parts(scheme: str, hostname: str, port: int | str = '', path: str = '', query: QuerySrc = '', fragment: str = '') → Self[source]

Create a new URL from component parts

Note

There is no ‘netloc’, ‘username’ or ‘password’ arguments. Credentials should not be encoded in URLs.

urljoin(other: str, /) → Url[source]

Join this URL as a base with a possibly relative URL to form an absolute URL

urlreplace(scheme: str = '', hostname: str = '', port: int | str = 0, path: str = '', query: QuerySrc = '', fragment: str = '') → Url[source]

Replace parts of the URL and return the new URL

Note

Username and password values cannot be replaced, and will be stripped from the new URL. These should not be encoded in URLs.

queryadd(src: QuerySrc = (), **extra: ParamValue) → Url[source]

Add query parameters to the URL and return the new URL

queryremove(*names: str) → Url[source]

Remove the named parameters (including repeats) from the URL and return the new URL

Subpackages

Submodules