Wrapper that retries failed lowhaio HTTP requests
Project description
lowhaio-retry
Wrapper that retries failed lowhaio HTTP requests. Allows retries of exceptions from failed HTTP requests.
Installation
pip install lowhaio_retry
Usage
The request
function returned from lowhaio.Pool
must be wrapped with lowhaio_retry.retry
, as in the below example. This will retry the request, waiting the specified interval between retries. If the request still fails, the final exception will be bubbled up to client code.
So instead of a request like
from lowhaio import Pool
request, _ = Pool()
body = ...
code, headers, body = await request(
b'PUT', 'https://example.com/path', body=body,
headers=((b'content-length', b'1234'),),
)
you can write
from lowhaio import Pool, HttpConnectionError, HttpDataError
from lowhaio_retry import retry
request, _ = Pool()
retriable_request = retry(request,
exception_intervals=(
# Seconds to wait after each exception
(HttpConnectionError, (0, 0, 0)),
(HttpDataError, (0, 1, 2, 4)),
),
)
body = ...
code, headers, body = await retriable_request(
b'PUT', 'https://example.com/path', body=body,
headers=((b'content-length', b'1234'),),
)
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
lowhaio_retry-0.0.5.tar.gz
(2.0 kB
view hashes)
Built Distribution
Close
Hashes for lowhaio_retry-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 587a71f85db754d53d72d13239bacbf3c30cb372e682cafe8088a82f297eb5c4 |
|
MD5 | 9e19a977137591e53607bef245c772b1 |
|
BLAKE2b-256 | b6da9da9c328cac8259c89651b59aae146a8580f3886bf2cabf086fadf0a4ba0 |