Skip to main content

Library to make your services reliable

Retry on specific exception

import yretry

@yretry.decorators.retry(attempts_number=3,
                         retry_on=(MyException,))
def reliable_function():
    raise MyException()

Specific function to make decision about retries

import yretry

def is_my_mistake(error):
    return isinstance(error, MyMistake)

@yretry.decorators.retry(attempts_number=3,
                         retry_on=is_my_mistake)
def reliable_function():
    raise MyMistake()

Retry on network errors

You can use following code to add retries for your custom network function:

import requests
import yretry

@yretry.network.retry()
def reliable_function():
   response = requests.get('http://localhost:5002')
   response.raise_for_status()
   return response

print reliable_function()

Logging

Global logger

You can pass specific logger to decorator:

import logging
import logging.config

LOGGING = {
    'version': 1,
    'formatters': {
        'precise': {
            'datefmt': '%Y-%m-%d,%H:%M:%S',
            'format': '%(levelname)-7s %(asctime)15s '
                      '%(name)s:%(lineno)d %(message)s'
        }
    },
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
            'formatter': 'precise',
            'stream': 'ext://sys.stderr'
        },
    },
    'root': {
        'level': 'INFO',
        'handlers': ['console']
    }
}

logging.config.dictConfig(LOGGING)

LOGGER = logging.getLogger(__name__)

@yretry.network.retry(logger=LOGGER)
def reliable_function():
   response = requests.get('http://localhost:5002')
   response.raise_for_status()
   return response

Object-specific logger

You can use object-specific logger, just add ‘get_logger’ method:

class MyClass(object):
   def __init__(self):
       self._logger = logging.getLogger(__name__)

   def get_logger(self):
       return self._logger

   @yretry.network.retry()
   def reliable_method(self):
       pass

obj = MyClass()
obj.reliable_method()
# obj._logger will be used to write warnings about retries

Metadata

Release files for yretry 1.0.2

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

Source distribution (sdist)

Source distribution for yretry 1.0.2
File Size Uploaded Provenance Actions
yretry-1.0.2.tar.gz 92.9 kB With provenance Details for yretry-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for yretry 1.0.2
File Interpreter ABI Platform Actions
yretry-1.0.2-py3-none-any.whl Python 3 none any Details for yretry-1.0.2-py3-none-any.whl

Total release size: 106.5 kB

Release files / yretry-1.0.2.tar.gz

Download URL yretry-1.0.2.tar.gz
Size 92.9 kB
Tags Source
SHA-256 checksum
How to use checksums
acf2b9234b7b9e474210171c0771cfcd552368a721f86046d877de7be5dc8d82
BLAKE2b-256 checksum
How to use checksums
e919b90907af922e18d51c1c99a8317bed18fe7f4b0dedf43967d66a09e62afc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 24, 2026.

Transparency log

Release files / yretry-1.0.2-py3-none-any.whl

Download URL yretry-1.0.2-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b55846aef40e2dca579c39fad1ee0a89f8f054badade67dd4e2d56cd8b11e36d
BLAKE2b-256 checksum
How to use checksums
e195d58b69bbad6592128b78dd8ccb89701540e050f6770762e273af89fe428c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 24, 2026.

Transparency log

Security for yretry 1.0.2

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for yretry-1.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 24, 2026.

Transparency log

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.

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