Skip to main content

An async Curl library.

Project description

Acurl

It is an asynchronous wrapper around libcurl which is built to interface with the Uvloop python library.

Using Acurl In Mite

The gateway into Acurl is through the CurlWrapper (discussed in Architectural Notes) and requires an event loop being passed to its constructor. Below is the mite implementation of acurl:

class SessionPool:
    ...
    def __init__(self):
        import acurl
        self._wrapper = acurl.CurlWrapper(asyncio.get_event_loop())
        ...

Architectural Notes

Acurl uses a single loop maintained within python using UVloop.

Acurl surfaces the CurlWrapper interface which takes the asyncio event loop as an argument. The wrapper deals directly with the curl_multi interface from libcurl, defining 2 functions (curl_perform_write and curl_perform_read) for checking both read and write availability of file descriptors.

There are 2 notable functions within the core Acurl implementation, notably handle_socket and start_timer:

  • handle_socket is passed as a callback function to the curl_multi interface and upon calls to the curl_multi_socket_action function, will receive updates regarding the socket status. We then handle those statuses by either adding or removing the aforementioned readers or writers.
  • start_timer is another callback function that is passed to the curl_multi interface and is used as a way to handle timeouts and retries within curl. Upon a timeout, the timeout callback will be called and the transfer can be retried.

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

acurl-1.0.7.tar.gz (167.5 kB view details)

Uploaded Source

File details

Details for the file acurl-1.0.7.tar.gz.

File metadata

  • Download URL: acurl-1.0.7.tar.gz
  • Upload date:
  • Size: 167.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for acurl-1.0.7.tar.gz
Algorithm Hash digest
SHA256 0295e91ab1b748b2a2e7042714950f425f8e9c0bda99b247772ed9d750aeae7e
MD5 7b534b16ad59cab31228b3c715eb9a02
BLAKE2b-256 a007a48992af9fb23f36d036431f79ba73831472918d952a6f44107ee77ba0f6

See more details on using hashes here.

Supported by

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