Pythonic, asynchronous interface to Curl (cURL) using `anyio`
Project description
Konnect
Konnect is a project to make the power of the libcurl multi feature available through a Pythonic interface. It consists of this core package (konnect.curl) through which any protocol provided by libcurl can be accessed and some additional packages (e.g. konnect.http) which provide enhanced interfaces for specific protocols.
Basic Usage
Users must first create a class that implements the konnect.curl.abc.RequestProtocol
interface; the methods of this protocol are essentially hooks that are called at certain
points in a transfer. The transfer commences when an instance of the request class is
passed to konnect.curl.Multi.process() and the returned awaitable is awaited:
-
configure_handleis called prior to connection with a singlekonnect.curl.abc.ConfigHandleobject as an argument. This object can be used to configure the request in a manner familiar to users of libcurl, by calling thekonnect.curl.abc.ConfigHandle.setopt()method of the object. In particular users should configure libcurl callbacks to handle various additional events specific to the desired protocol. -
has_update&get_updateare called continuously throughout the transfer. The latter, if it returns anything, interrupts the transfer and returns the value fromkonnect.curl.Multi.process(). The user would normally then continue the transfer by callingkonnect.curl.Multi.process()again with the same multi and request objects. It is up to the user to recognise when the return is an interim response or a final response, normally by checking the type of the response. If the implementation has nothing to return during the transferhas_updatecan simply returnFalseevery time it is called. -
completedis called after the transfer is finished, with akonnect.curl.abc.GetInfoHandleobject that may be used to examine information about the transfer in a way familiar to libcurl users, with it'skonnect.curl.abc.GetInfoHandle.getinfo()andkonnect.curl.abc.GetInfoHandle.getinfo_raw()methods.
Instances of konnect.curl.Multi are shareable within a thread and although it is possible
to use multiple instances it is recommended for performance and resource usage reasons to
use only one.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file konnect_curl-0.2.4.tar.gz.
File metadata
- Download URL: konnect_curl-0.2.4.tar.gz
- Upload date:
- Size: 30.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b9454a14fd3ee072618775faaff348261d8265efb9d1dd9654e7aac0b74e8ed
|
|
| MD5 |
4419e48fd53efe13e03612709f887eb8
|
|
| BLAKE2b-256 |
f3ae27b0bdd0ce80ebe4714bba3a64b607ad3f1c79797ae848d568e88138476c
|
File details
Details for the file konnect_curl-0.2.4-py3-none-any.whl.
File metadata
- Download URL: konnect_curl-0.2.4-py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
685f31514558a7741560ab1b01761d4b9789f6edaf6078fcf8fe2fddb001540c
|
|
| MD5 |
7c973e8edccb568b2f38a8a46e187f48
|
|
| BLAKE2b-256 |
103996d4ad8dbe30803274bce66dcd9d32d02392df523eb1d2d201a0d846014b
|