semvec/pypi-packages huggingface dataset:
sure-retry 0.1.0
A Python library providing retry decorators.
License: MIT
Requires Python: >=3.6

# sure_retry

sure_retry is a Python library designed to simplify the creation of retry decorators. With sure_retry, you can effortlessly add retry logic to your functions, helping them handle transient errors more gracefully.

## Features

- **Easy to use**: Apply retry logic with minimal code changes.
- **Configurable**: Customize the number of retries, delay between retries, and more.
- **Flexible**: Use with any Python function.
```sh
pip install sure_retry
```
## Usage

To use sure_retry, you simply need to import it and apply the retry decorator to the function you want to wrap. Here is an example:

```python
from sure_retry import retry, silent_retry_with_default

# Simple usage with default settings
@retry
def my_function():
    # Function logic that may fail
    print("Attempting the operation...")
    raise ValueError("An error occurred!")

# Customizing the retry logic
@retry(retries=5, retry_delay=2, exceptions=(IOError, ), error_message="Custom error message")
def my_other_function():
    # Function logic that may fail
    print("Attempting another operation...")
    raise IOError("Another error occurred!")

# Using the silent retry decorator
@silent_retry_with_default(default_return_value=-1, retries=5, retry_delay=3, exceptions=(RuntimeError,), error_message="Operation failed after retries")
def my_silent_function():
    # Function logic that may fail
    print("Attempting the silent operation...")
    raise RuntimeError("A runtime error occurred!")
```
## Parameters

The `@retry` decorator accepts the following parameters:

- **retries** (int): The maximum number of retry attempts. Default is `3`.
- **retry_delay** (int or float): The delay (in seconds) between retry attempts. Default is `2`.
- **exceptions** (tuple): A tuple of exception classes that will trigger a retry. Default is `(Exception,)`.
- **error_message** (str): The error message to be raised when the retry attempts are exceeded. Default is `"Max retries exceeded"`.

The `@silent_retry_with_default` decorator accepts the following parameters:

- **default_return_value** (any): The value to return if the retries are exceeded. Default is `None`.
- **retries** (int): The maximum number of retry attempts. Default is `3`.
- **retry_delay** (int or float): The delay (in seconds) between retry attempts. Default is `2`.
- **exceptions** (tuple): A tuple of exception classes that will trigger a retry. Default is `(Exception,)`.
- **error_message** (str): The error message to be logged when the retry attempts are exceeded. Default is `"Max retries exceeded"`.

## Contributing

We welcome contributions! Please submit a pull request or open an issue to help improve sure_retry.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.

## Acknowledgements

This library was inspired by the need for simple and configurable retry logic in Python functions.
logstop 0.2.0
Keep personal data out of your logs
License: MIT
Requires Python: >=3.9

# Logstop.py

🔥 Keep personal data out of your logs

```python
logger.info('Hi test@example.org!')
# Hi **********!
```

By default, scrubs:

- email addresses
- phone numbers
- credit card numbers
- Social Security numbers (SSNs)
- passwords in URLs

Works even when data is URL-encoded with plus encoding

[![Build Status](https://github.com/ankane/logstop.py/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/logstop.py/actions)

## Installation

Run:

```sh
pip install logstop
```

And add it to your logger:

```python
from logstop import LogstopFilter

logger.addFilter(LogstopFilter())
```

## Options

To scrub IP addresses (IPv4), use:

```python
LogstopFilter(ip=True)
```

To scrub MAC addresses, use:

```python
LogstopFilter(mac=True)
```

Disable default rules with:

```python
LogstopFilter(
    email=False,
    phone=False,
    credit_card=False,
    ssn=False,
    url_password=False
)
```

## Notes

- To scrub existing log files, check out [scrubadub](https://github.com/datascopeanalytics/scrubadub)
- To scan for unencrypted personal data in your database, check out [pdscan](https://github.com/ankane/pdscan)

## History

View the [changelog](https://github.com/ankane/logstop.py/blob/master/CHANGELOG.md)

## Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

- [Report bugs](https://github.com/ankane/logstop.py/issues)
- Fix bugs and [submit pull requests](https://github.com/ankane/logstop.py/pulls)
- Write, clarify, or fix documentation
- Suggest or add new features

To get started with development:

```sh
git clone https://github.com/ankane/logstop.py.git
cd logstop.py
pip install -r requirements.txt
pytest
```