retryit 🔄
Smart retry decorator with exponential backoff for Python.
Installation
pip install retryit
Usage
from retryit import retry
@retry(max_attempts=3, delay=1, backoff=2)
def fetch_data():
return requests.get("https://api.example.com/data")
# With specific exceptions
@retry(max_attempts=5, exceptions=(ConnectionError, TimeoutError))
def connect_to_db():
return database.connect()
# With callback on retry
def log_retry(exception, attempt):
print(f"Attempt {attempt} failed: {exception}")
@retry(max_attempts=3, on_retry=log_retry)
def unreliable_function():
# ...
Async Support
from retryit import retry_async
@retry_async(max_attempts=3, delay=1)
async def fetch_data():
async with aiohttp.ClientSession() as session:
return await session.get("https://api.example.com/data")
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
max_attempts |
int | 3 | Maximum retry attempts |
delay |
float | 1.0 | Initial delay (seconds) |
backoff |
float | 2.0 | Delay multiplier |
exceptions |
tuple | (Exception,) | Exceptions to catch |
on_retry |
callable | None | Callback on each retry |
License
MIT
Metadata
Release files for pyretryit-rj 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyretryit_rj-1.0.0.tar.gz | 2.8 kB | Without provenance | Details for pyretryit_rj-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyretryit_rj-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for pyretryit_rj-1.0.0-py3-none-any.whl |
Total release size: 6.0 kB
Release files / pyretryit_rj-1.0.0.tar.gz
| Download URL | pyretryit_rj-1.0.0.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c5d46c695b7f67d477812fbe744d40e17f06bf165da21dd8ff2dfd2ef2563f5
|
|
BLAKE2b-256 checksum How to use checksums |
6ee202c19b2b2054cdb41340a5436209ce557df3b369c60bc4bcce7500cd7762
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / pyretryit_rj-1.0.0-py3-none-any.whl
| Download URL | pyretryit_rj-1.0.0-py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c3becd5b3469b7dfdf1466c25cd101dbad7b4506ea07d7dd783a88b696b0802e
|
|
BLAKE2b-256 checksum How to use checksums |
9ab3377141587b77926d9a29a1749412b9ce9c9409c1923a51ac0d0999a7096c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Security for pyretryit-rj 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.