Skip to main content

Pythonic, asynchronous interface to Curl (cURL) using `anyio`

Project description

gitlab-ico

licence-mpl20 pre-commit-ico

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_handle is called prior to connection with a single konnect.curl.abc.ConfigHandle object as an argument. This object can be used to configure the request in a manner familiar to users of libcurl, by calling the konnect.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_update are called continuously throughout the transfer. The latter, if it returns anything, interrupts the transfer and returns the value from konnect.curl.Multi.process(). The user would normally then continue the transfer by calling konnect.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 transfer has_update can simply return False every time it is called.

  • completed is called after the transfer is finished, with a konnect.curl.abc.GetInfoHandle object that may be used to examine information about the transfer in a way familiar to libcurl users, with it's konnect.curl.abc.GetInfoHandle.getinfo() and konnect.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

konnect_curl-0.2.4.tar.gz (30.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

konnect_curl-0.2.4-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

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

Hashes for konnect_curl-0.2.4.tar.gz
Algorithm Hash digest
SHA256 6b9454a14fd3ee072618775faaff348261d8265efb9d1dd9654e7aac0b74e8ed
MD5 4419e48fd53efe13e03612709f887eb8
BLAKE2b-256 f3ae27b0bdd0ce80ebe4714bba3a64b607ad3f1c79797ae848d568e88138476c

See more details on using hashes here.

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

Hashes for konnect_curl-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 685f31514558a7741560ab1b01761d4b9789f6edaf6078fcf8fe2fddb001540c
MD5 7c973e8edccb568b2f38a8a46e187f48
BLAKE2b-256 103996d4ad8dbe30803274bce66dcd9d32d02392df523eb1d2d201a0d846014b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page