An async Curl library.
Project description
Acurl_NG (Next Generation)
Acurl_NG is a Cython refactoring/rewrite of an earlier iteration of the asynchronous curl wrapper concept, which was written in C for the mite project by Tony Simpson agjasimpson@gmail.com. It is an asynchronous wrapper around libcurl which is built to interface with the Uvloop python library.
Using Acurl_NG In Mite
The current implementation of Acurl_NG is behind a feature toggle which defaults to using the old implementation of acurl. To switch over to using the new version of Acurl_NG within mite, the flag MITE_CONF_enable_new_acurl_implementation="True"
The gateway into Acurl_NG is through the CurlWrapper (discussed in Architectural Notes) and requires an event loop being passed to it's constructor. Below is the mite implementation of acurl, using the aforementioned flag to switch between versions of acurl:
class SessionPool:
...
def __init__(self, use_new_acurl_implementation=False):
if use_new_acurl_implementation:
import acurl_ng
self._wrapper = acurl_ng.CurlWrapper(asyncio.get_event_loop())
else:
import acurl
self._wrapper = acurl.EventLoop()
...
Architectural Notes
In the old implementation of acurl there was two loops in play, UVloop in python and a second loop called AE. This has now been reduced to a single loop maintained within python using UVloop.
Acurl_NG 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_NG implementation, notably handle_socket and start_timer:
handle_socketis passed as a callback function to the curl_multi interface and upon calls to thecurl_multi_socket_actionfunction, will receive updates regarding the socket status. We then handle those statuses by either adding or removing the aforementioned readers or writers.start_timeris 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
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 acurl_ng-0.1.tar.gz.
File metadata
- Download URL: acurl_ng-0.1.tar.gz
- Upload date:
- Size: 170.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad922fca38371f69006df7f3aed9f727b9b618f47bc189655b51c9f9cae35962
|
|
| MD5 |
39ef6db23fbc705fbe98e80cd52d1936
|
|
| BLAKE2b-256 |
ffe1b015a4bf851a7ac3cd9d2c2c34dcc8b94612433d4cec5f78ba4b10d98e2e
|
File details
Details for the file acurl_ng-0.1-cp39-cp39-macosx_12_0_arm64.whl.
File metadata
- Download URL: acurl_ng-0.1-cp39-cp39-macosx_12_0_arm64.whl
- Upload date:
- Size: 113.7 kB
- Tags: CPython 3.9, macOS 12.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c64ece837363479ddb7f4f19c67af7494f6298ab72e9b72e36fcad0b154b90e
|
|
| MD5 |
db5d77d6935464c118fab2aadc83381a
|
|
| BLAKE2b-256 |
5fa157b154c4c53801c8aec28f38e4ad6d8c39a2ab1c1da5e22b60fffc128f17
|
File details
Details for the file acurl_ng-0.1-cp39-cp39-macosx_10_15_x86_64.whl.
File metadata
- Download URL: acurl_ng-0.1-cp39-cp39-macosx_10_15_x86_64.whl
- Upload date:
- Size: 131.5 kB
- Tags: CPython 3.9, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7681aa3fb8c1e6c3dcd7a407b56e89dceac57ab98ec19caeb9cb79136b59453
|
|
| MD5 |
f0e14cc313d8c6cc74b1a8d7bb782383
|
|
| BLAKE2b-256 |
fb1758bbdf273336e28e5651873a7d8f498f2bb771cca7bd6126c5f10c8ca793
|
File details
Details for the file acurl_ng-0.1-cp38-cp38-macosx_11_0_arm64.whl.
File metadata
- Download URL: acurl_ng-0.1-cp38-cp38-macosx_11_0_arm64.whl
- Upload date:
- Size: 113.2 kB
- Tags: CPython 3.8, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc867a35b8ca380a1eb1b9d52a514dc7c29a4ca86fd26d5d36f9e07de2109ee3
|
|
| MD5 |
cfb75715b8ac6ec7856996fc64ab6ed7
|
|
| BLAKE2b-256 |
eb5c09c2a08405a1e4923e0e493c8cf2de78d9c3ae01b509dba30bfaced57f8a
|