konnect.curl.abc module
Abstract protocols which may be implemented by users
curl provides simple implementations of these protocols which may be used directly
or subclassed by users.
- class ConfigHandle(*args, **kwargs)[source]
Bases:
ProtocolThe interface provided by objects passed to
Request.configure_handle()- setopt(option: int, value: object, /) None[source]
Set an option on a Curl handle
See https://curl.se/libcurl/c/curl_easy_setopt.html for a list of options and what they do.
- pause(state: int, /) None[source]
Set the paused state of a Curl handle
This is provided for request implementations that need to await upload data, they may store the handle or method for later use. In a future release it will be deprecated in favour of a method that returns an asynchronously writable object.
Deprecated since version 0.3.0: Use
Multi.get_send_streamandMulti.get_receive_streamto control I/O flow
- class GetInfoHandle(*args, **kwargs)[source]
Bases:
ProtocolThe interface provided by objects passed to
Request.completed()- getinfo(option: int, /) object[source]
Return information about a Curl handle
Note that string values are returned as unicode strings.
See https://curl.se/libcurl/c/curl_easy_getinfo.html for a list of options and what they return.
- getinfo_raw(option: int, /) object[source]
Like
GetInfoHandle.getinfo()but string values are returned as byte strings
- class UpdateHandler(*args, **kwargs)[source]
-
Implementations of this protocol control when and what is returned from
Multi.processUpdate handlers form a part of the
Requestprotocol and are used internally for controlling when program flow exits from the «I/O ↔ libcurl ↔ callbacks» flow that forms the core of theMulti.processawaitable.- has_update() bool[source]
Return whether calling
UpdateHandler.get_update()will return a value or raiseLookupError
- get_update() UpdateT[source]
Return a waiting update or raise
LookupErrorif there is noneMulti.processwill only call this method whenUpdateHandler.has_update()indicates an update is available. The returned value will be returned byMulti.process.Note that values returned by this method are interim updates, and
Multi.processwill be called again with the current request. It is up to the implementer how many times updates will be returned and what objects to return as updates: it may be different objects for different stages of a transfer; or there may never be interim updates.
- class Request(*args, **kwargs)[source]
Bases:
UpdateHandler,Protocol,GenericRequest classes that are passed to
Multi.processmust implement this protocol- configure_handle(handle: ConfigHandle, /) None[source]
Configure a Curl handle for the request by calling
ConfigHandlemethodsSee https://curl.se/libcurl/c/curl_easy_setopt.html for a list of options and what they do.
- completed(handle: GetInfoHandle, /) ResultT[source]
Indicate that Curl has completed processing the handle and return a final response
Like
Request.get_updatethis method’s return value will be returned byMulti.process. UnlikeRequest.get_updatethis method will be called exactly once for a successful transfer.The
GetInfoHandlepassed as a positional argument may be used to get post-completion information about a transfer, see https://curl.se/libcurl/c/curl_easy_getinfo.html for a list of options and what they return.