retry-later


Nameretry-later JSON
Version 0.0.5 PyPI version JSON
download
home_page
SummaryRetry your functions later, asynchronously
upload_time2024-03-17 19:24:17
maintainer
docs_urlNone
author
requires_python>=3.9
licenseMIT License Copyright (c) 2024 Krishnasis Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords utils retry python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![latest](https://github.com/krishnasism/retry-later/actions/workflows/publish.yml/badge.svg)](https://github.com/krishnasism/retry-later/actions/workflows/publish.yml)
[![tests](https://github.com/krishnasism/retry-later/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/krishnasism/retry-later/actions/workflows/test.yml)
[![Coverage Status](https://coveralls.io/repos/github/krishnasism/retry-later/badge.svg?branch=main)](https://coveralls.io/github/krishnasism/retry-later?branch=main)
# retry_later

`@retry_later` allows you to retry the execution of a function asynchronously in the background until it's done.

### Why?

For example, you can retry sending an email until it's sent.

## Installation

```bash
pip install retry-later
```

## Usage

Simply add `@retry_later()` to your function. This also works with `async` functions.

Look inside the `examples` folder for more examples!

Here's a simple demonstration:

```python
from my_very_python_real_email_client import send_mail_to_friend, send_text_to_friend
import asyncio

# Create new event loop
loop = asyncio.new_event_loop()

# Import the decorator
from retry_later import retry_later

@retry_later(retry_interval=10, max_retries=5, exception=ConnectionError)
def send_email():
    send_mail_to_friend(email="veryrealperson@veryrealemail.haha", body="hi!")

@retry_later(retry_interval=10, max_retries=5, exception=ConnectionError)
async def send_a_text():
    await send_text_to_friend(number="+123456789", body="hi! texting you")

send_email()
asyncio.run(send_a_text())

# Other stuff
print("Hi - I am here!! I complete before my_function!")

# event loop must be running for retry_later to work
loop.run_forever()

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "retry-later",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "Krishnasis Mandal <krishnasis.mandal@prestatech.com>",
    "keywords": "utils,retry,python",
    "author": "",
    "author_email": "Krishnasis Mandal <krishnasis.mandal@prestatech.com>",
    "download_url": "https://files.pythonhosted.org/packages/ae/bc/d8b934d54008cbb748406ca07f4ddd522e683e2e896c760194290941a1b3/retry_later-0.0.5.tar.gz",
    "platform": null,
    "description": "[![latest](https://github.com/krishnasism/retry-later/actions/workflows/publish.yml/badge.svg)](https://github.com/krishnasism/retry-later/actions/workflows/publish.yml)\n[![tests](https://github.com/krishnasism/retry-later/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/krishnasism/retry-later/actions/workflows/test.yml)\n[![Coverage Status](https://coveralls.io/repos/github/krishnasism/retry-later/badge.svg?branch=main)](https://coveralls.io/github/krishnasism/retry-later?branch=main)\n# retry_later\n\n`@retry_later` allows you to retry the execution of a function asynchronously in the background until it's done.\n\n### Why?\n\nFor example, you can retry sending an email until it's sent.\n\n## Installation\n\n```bash\npip install retry-later\n```\n\n## Usage\n\nSimply add `@retry_later()` to your function. This also works with `async` functions.\n\nLook inside the `examples` folder for more examples!\n\nHere's a simple demonstration:\n\n```python\nfrom my_very_python_real_email_client import send_mail_to_friend, send_text_to_friend\nimport asyncio\n\n# Create new event loop\nloop = asyncio.new_event_loop()\n\n# Import the decorator\nfrom retry_later import retry_later\n\n@retry_later(retry_interval=10, max_retries=5, exception=ConnectionError)\ndef send_email():\n    send_mail_to_friend(email=\"veryrealperson@veryrealemail.haha\", body=\"hi!\")\n\n@retry_later(retry_interval=10, max_retries=5, exception=ConnectionError)\nasync def send_a_text():\n    await send_text_to_friend(number=\"+123456789\", body=\"hi! texting you\")\n\nsend_email()\nasyncio.run(send_a_text())\n\n# Other stuff\nprint(\"Hi - I am here!! I complete before my_function!\")\n\n# event loop must be running for retry_later to work\nloop.run_forever()\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Krishnasis  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Retry your functions later, asynchronously",
    "version": "0.0.5",
    "project_urls": null,
    "split_keywords": [
        "utils",
        "retry",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b930ba311d63618b462b64e6f3253ab974dbdd3f0cfbaed1a64af639dad03b36",
                "md5": "fa902c17a5b8fb69e68280f5199e6716",
                "sha256": "121a7ccb979c450f28cee0d4b2dd1792a2181d1eeb3936c36d64d6847899413f"
            },
            "downloads": -1,
            "filename": "retry_later-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fa902c17a5b8fb69e68280f5199e6716",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 5091,
            "upload_time": "2024-03-17T19:24:15",
            "upload_time_iso_8601": "2024-03-17T19:24:15.779208Z",
            "url": "https://files.pythonhosted.org/packages/b9/30/ba311d63618b462b64e6f3253ab974dbdd3f0cfbaed1a64af639dad03b36/retry_later-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "aebcd8b934d54008cbb748406ca07f4ddd522e683e2e896c760194290941a1b3",
                "md5": "3c17fcc9e89dcf853d3d411e7c8672e4",
                "sha256": "9d8ec60122da4d8a651e4c8a3022cea04542b63ea80a33bf46f9de830fa2d258"
            },
            "downloads": -1,
            "filename": "retry_later-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "3c17fcc9e89dcf853d3d411e7c8672e4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 5019,
            "upload_time": "2024-03-17T19:24:17",
            "upload_time_iso_8601": "2024-03-17T19:24:17.416846Z",
            "url": "https://files.pythonhosted.org/packages/ae/bc/d8b934d54008cbb748406ca07f4ddd522e683e2e896c760194290941a1b3/retry_later-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-17 19:24:17",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "retry-later"
}
        
Elapsed time: 0.22644s