retry-requests


Nameretry-requests JSON
Version 2.0.0 PyPI version JSON
download
home_pagehttps://github.com/bustawin/retry-requests
SummaryMake requests's sessions auto-retry on failure.
upload_time2023-05-28 18:33:08
maintainer
docs_urlNone
authorXavier Bustamante Talavera
requires_python>=3.6
licenseGPLv3+
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Retry-requests
##############
Configures the passed-in `requests' <http://python-requests.org>`_ ``Session``
to retry on failed requests due to connection errors, timeouts,
specific HTTP response codes (5XX by default) and 30X redirections
—anything that could fail.

Python 3.6+.

Basic usage:

.. code-block:: python

  from retry_requests import retry
  my_session = retry()
  my_session.get("http://foo.bar")

This ``get`` will retry three times in case of error waiting some time between retries.
Errors could be:

- Waiting for the server to start answering for 5 seconds.
- No access to the server or a dropped connection.
- An HTTP answer of 500, 502, or 504.

You can change these defaults:

.. code-block:: python

  from retry_requests import retry
  from requests import Session
  my_session = retry(Session(), retries=5, backoff_factor=0.2)
  my_session.get('https://foo.bar')

Check the function ``retry`` to know more about this configuration.

Note that you have a ``TSession``, a ``Session`` with a default timeout,
and ``RSession``, a ``Session`` with a timeout that always ``raise_for_status()``,
for your convenience.


Heavily inspired from `Peterbe.com <https://www.peterbe.com/plog/
best-practice-with-retries-with-requests>`_. Thank you!

Installing
**********
Just ``pip install retry-requests``.

Testing
*******
Clone this project and then, at its root directory, run ``python setup.py test``.
Note that you need an active Internet connection to run the tests.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bustawin/retry-requests",
    "name": "retry-requests",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "Xavier Bustamante Talavera",
    "author_email": "xavier@bustawin.com",
    "download_url": "https://files.pythonhosted.org/packages/1e/da/6e961557733660bef8d095a1d81423a3707486e2b2ecd2c5ad5ad8d2f59d/retry-requests-2.0.0.tar.gz",
    "platform": null,
    "description": "Retry-requests\n##############\nConfigures the passed-in `requests' <http://python-requests.org>`_ ``Session``\nto retry on failed requests due to connection errors, timeouts,\nspecific HTTP response codes (5XX by default) and 30X redirections\n\u2014anything that could fail.\n\nPython 3.6+.\n\nBasic usage:\n\n.. code-block:: python\n\n  from retry_requests import retry\n  my_session = retry()\n  my_session.get(\"http://foo.bar\")\n\nThis ``get`` will retry three times in case of error waiting some time between retries.\nErrors could be:\n\n- Waiting for the server to start answering for 5 seconds.\n- No access to the server or a dropped connection.\n- An HTTP answer of 500, 502, or 504.\n\nYou can change these defaults:\n\n.. code-block:: python\n\n  from retry_requests import retry\n  from requests import Session\n  my_session = retry(Session(), retries=5, backoff_factor=0.2)\n  my_session.get('https://foo.bar')\n\nCheck the function ``retry`` to know more about this configuration.\n\nNote that you have a ``TSession``, a ``Session`` with a default timeout,\nand ``RSession``, a ``Session`` with a timeout that always ``raise_for_status()``,\nfor your convenience.\n\n\nHeavily inspired from `Peterbe.com <https://www.peterbe.com/plog/\nbest-practice-with-retries-with-requests>`_. Thank you!\n\nInstalling\n**********\nJust ``pip install retry-requests``.\n\nTesting\n*******\nClone this project and then, at its root directory, run ``python setup.py test``.\nNote that you need an active Internet connection to run the tests.\n",
    "bugtrack_url": null,
    "license": "GPLv3+",
    "summary": "Make requests's sessions auto-retry on failure.",
    "version": "2.0.0",
    "project_urls": {
        "Code": "https://github.com/bustawin/retry-requests",
        "Documentation": "https://github.com/bustawin/retry-requests",
        "Homepage": "https://github.com/bustawin/retry-requests",
        "Issue tracker": "https://github.com/bustawin/retry-requests/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b1f38ce908497bebbc2790ef06240a2c0fb28c096abb59062d88f85090464a5f",
                "md5": "89c529072975d4251f18836aa09ddc0d",
                "sha256": "38e8e3f55051e7b7915c1768884269097865a5da2ea87d5dcafd6ba9498c363f"
            },
            "downloads": -1,
            "filename": "retry_requests-2.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "89c529072975d4251f18836aa09ddc0d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 15772,
            "upload_time": "2023-05-28T18:33:05",
            "upload_time_iso_8601": "2023-05-28T18:33:05.868085Z",
            "url": "https://files.pythonhosted.org/packages/b1/f3/8ce908497bebbc2790ef06240a2c0fb28c096abb59062d88f85090464a5f/retry_requests-2.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1eda6e961557733660bef8d095a1d81423a3707486e2b2ecd2c5ad5ad8d2f59d",
                "md5": "2aa1ae11b215365b00e2b713f2188586",
                "sha256": "3d02135e5aafedf09240414182fc7389c5d2b4de0252daba0054c9d6a27e7639"
            },
            "downloads": -1,
            "filename": "retry-requests-2.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2aa1ae11b215365b00e2b713f2188586",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 16084,
            "upload_time": "2023-05-28T18:33:08",
            "upload_time_iso_8601": "2023-05-28T18:33:08.196015Z",
            "url": "https://files.pythonhosted.org/packages/1e/da/6e961557733660bef8d095a1d81423a3707486e2b2ecd2c5ad5ad8d2f59d/retry-requests-2.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-28 18:33:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bustawin",
    "github_project": "retry-requests",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "retry-requests"
}
        
Elapsed time: 6.64413s