Skip to main content

Retry Helper

Helper tool fro retrying code when soem exceptions occur

Usage

RetryManager

Retry manager is context manager for retrying block of code. In fact its double layer context manager in first context you will create context manager and use while retry object is true. And the run you code in context of retry.attempt.

  • max_attempts - maximum count of attempts, default 1
  • wait_seconds - How many second it should wait before next retry, default 0
  • exceptions - exception class or tuple of exceptions classes which cause retry, if None all exceptions cause retry default None
  • reset_func - function to be run before each retry (it is not call on first try)
with RetryManager(max_attempts=20, wait_seconds=1, exceptions=(TypeError,KeyError)) as retry:
while retry:
    with retry.attempt:
        # code raising exception if fail

Metadata

Release files for retry-helper 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for retry-helper 0.0.4
File Size Uploaded
retry_helper-0.0.4.tar.gz 3.4 kB Details

Release files / retry_helper-0.0.4.tar.gz

Download URL retry_helper-0.0.4.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8d76c1fcff4719e0916f452fc30f9828a98c64150904a5fafd6a2a37a7190d3b
BLAKE2b-256 checksum
How to use checksums
d9c812be74c0b0715f552bc417c7a50fd4763b2f30d93cba84333a8a3601fe0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.0.4 This release

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page