semvec/pypi-packages huggingface dataset:
topgen 0.1.1
Time-based one-time password generator
License: MIT
Requires Python: >=3.10
Keywords: totp, totp-generator, totp-cli, google-authenticator

# Time-based One-time Password Generator (topgen)

This is a simple time-based one-time password generator. It is compatible with [Google Autheticator](https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2) and keys can imported from `otpauth-migration://offline?data=...` urls generated by Google Autheticator.

## Installation

topgen is tested with python 3.10 but it should work all python 3 versions. Requirement packages can be installed in two ways:

```
pip install topgen
```

## Usage

It is needed to first add or import some keys.

New keys can be added with `--add` parameter:

```
python -m topgen --add
```

To import keys from Google Authenticator app `--url` parameter can be used. It is done by the URLs that Google Authenticator creates. The URLs can be easily be created by exporting keys from the settings menu of Google Authenticator. Google Autheticator creates QR codes which contain the URLs. The URLs start with `otpauth-migration://offline?data=...`. These URLs can then be imported using the following command:

```
python -m topgen --url <URL>
```

Once you add or import some keys, passwords can be generated with the following command:

```
python -m topgen
```

top-g saves all keys in a binary file using Google's [protobuf](https://developers.google.com/protocol-buffers). The default file is `./payload.db`. It can be changed by providing `--db` parameter.

To print all of the keys with their information `--print` parameter can be used.

```
python -m topgen --list
```

NOTE: The database file is not encrypted. You are responsible to keep the database file secret and take your own risk.

## Thanks

I want to thank you to [Dimitri Sokolyuk](https://github.com/dim13) for his [Google Authenticator migration decoder](https://github.com/dim13/otpauth) and [Patrice Ferlet](https://github.com/metal3d) and [Tom Jaskowski](https://github.com/tadeck) for their answers under [this](https://stackoverflow.com/questions/8529265/google-authenticator-implementation-in-python) stackoverflow page.

## References

1. TOTP: Time-Based One-Time Password Algorithm: https://www.rfc-editor.org/rfc/rfc6238
1. HOTP: An HMAC-Based One-Time Password Algorithm: https://www.rfc-editor.org/rfc/rfc4226
retryerx 0.1.0
A Python library providing retry decorators.
License: MIT
Requires Python: >=3.6

# Retryer

Retryer is a Python library designed to simplify the creation of retry decorators. With Retryer, 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 retryer
```
## Usage

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

```python
from retryer 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 Retryer.

## 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.