Skip to main content

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.1.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

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

lowhaio_retry-0.0.1-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file lowhaio_retry-0.0.1.tar.gz.

File metadata

  • Download URL: lowhaio_retry-0.0.1.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for lowhaio_retry-0.0.1.tar.gz
Algorithm Hash digest
SHA256 faa95ea7d9dc17acb01a69b267ca91fb5d0794d52d32828f1592787b49d9d01a
MD5 307cda79fcb331c9a3067f440d74fca1
BLAKE2b-256 b0eff68b1c5b4ba954bf45426dffa4d303ce612b3e4537c453ecd0b3dc6b5ea7

See more details on using hashes here.

File details

Details for the file lowhaio_retry-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: lowhaio_retry-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for lowhaio_retry-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 33c7753b3a6cd751f811817822d9a948034dde255c58d4e62979c618092c256d
MD5 2a3f95211fdd9f7e0591254aedaa6272
BLAKE2b-256 b1740cf2560101d0c8dceac75c7e9e3db7e1f3cf078c5382e07e8f4daaa345b9

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