{"id":15009801,"url":"https://github.com/chambersh1129/requests-session-plus","last_synced_at":"2026-03-16T15:35:07.314Z","repository":{"id":64838835,"uuid":"577931313","full_name":"chambersh1129/requests-session-plus","owner":"chambersh1129","description":"Drop in replacement from requests.Session with some QOL enhancements","archived":false,"fork":false,"pushed_at":"2023-02-15T15:25:17.000Z","size":117,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-19T10:09:22.426Z","etag":null,"topics":["http","python","requests"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chambersh1129.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-13T21:26:44.000Z","updated_at":"2023-02-01T01:04:49.000Z","dependencies_parsed_at":"2024-10-12T09:50:57.684Z","dependency_job_id":null,"html_url":"https://github.com/chambersh1129/requests-session-plus","commit_stats":{"total_commits":49,"total_committers":1,"mean_commits":49.0,"dds":0.0,"last_synced_commit":"2ad47f68fe1184f2d6d0a3d4cc6de6f160a3089b"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chambersh1129%2Frequests-session-plus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chambersh1129%2Frequests-session-plus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chambersh1129%2Frequests-session-plus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chambersh1129%2Frequests-session-plus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chambersh1129","download_url":"https://codeload.github.com/chambersh1129/requests-session-plus/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243258502,"owners_count":20262300,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http","python","requests"],"created_at":"2024-09-24T19:28:40.267Z","updated_at":"2025-12-25T15:37:15.391Z","avatar_url":"https://github.com/chambersh1129.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# requests-session-plus\n\nDrop in replacement for [requests.Session()](https://requests.readthedocs.io/en/latest/user/advanced/#session-objects) with some quality of life enhancements.\n\n```python\n\u003e\u003e\u003e from requests_session_plus import SessionPlus  # equivalent to \"from requests import Session\"\n\u003e\u003e\u003e s = SessionPlus()\n\u003e\u003e\u003e r = s.get(\"https://httpbin.org/basic-auth/user/pass\", auth=(\"user\", \"pass\"))\n\u003e\u003e\u003e r.status_code\n200\n\u003e\u003e\u003e r.headers[\"content-type\"]\n'application/json'\n\u003e\u003e\u003e r.encoding\n'utf-8'\n\u003e\u003e\u003e r.text\n'{\\n  \"authenticated\": true, \\n  \"user\": \"user\"\\n}\\n'\n\n```\n\n[![build](https://github.com/chambersh1129/requests-session-plus/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/chambersh1129/requests-session-plus/actions/workflows/build.yml?query=branch%3Amain)\n[![codecov](https://codecov.io/gh/chambersh1129/requests-session-plus/branch/main/graph/badge.svg)](https://codecov.io/gh/chambersh1129/requests-session-plus)\n![pypi](https://img.shields.io/badge/pypi-1.0.4-blue)\n![python](https://img.shields.io/badge/python-3.7%20%7C%203.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue)\n![requests](https://img.shields.io/badge/requests-2.26%20%7C%202.27%20%7C%202.28%20%7C%20latest-blue)\n![license](https://img.shields.io/badge/license-GNUv3-green)\n![code style](https://img.shields.io/badge/code%20style-black-black)\n\n\n# Installing requests_session_plus\n\nrequests_session_plus is available on PyPI:\n\n```console\n$ python -m pip install requests-session-plus\n```\n\n# Comparison to Requests Session Class\n\nAll of these features are currently available in the standard requests Session class with some configuration/modification.  The goal of SessionPlus is to make them more easily accessible.\n\nFeature | Session() | SessionPlus() |\n--- | --- | ---\nDefault HTTP(S) Call Timeout | 0 | 10 |\nHTTP(S) Timeout Set | per call | globally and per call | |\nDisable Certificate Verification | per call | globally and per call |\nDisable Certificate Verification Warnings | no | yes |\nRaise Exceptions For Client/Server Issues | no | yes |\nRetry Count | 0 | 5 |\nRetry Backoff Factor | 0 | 2 |\nRetry For Status Codes | 413, 429, 503 | 413, 429, 500, 502-504 |\n\nTimeouts and certificate verification are enabled by default in SessionPlus, the others disabled.  All features can be enabled/disabled ad hoc as needed.\n\n# Usage\n\nSessionPlus can be used in the exact same way as a [requests Session object](https://requests.readthedocs.io/en/latest/user/advanced/#session-objects) so I'm going to rely on their documentation for most use cases.  In the following sections I'll just go over the benefits of each feature this package utilizes and how to enable/disable/modify them.\n\nTo make the most out of this package and its features you should have a strong understanding of your HTTP endpoints and how each feature could help.  Some suspiciously specific examples that I may or may not have run into:\n\n- Making API calls to an internal network appliance where tacacs occasionally fails?\n    - Disable certificate verification\n    - Enable retries\n    - Add 401 to \"retry_status_forcelist\" parameter\n- Is there an API endpoint hosted in Kubernetes where aggressive health checks recycle the containers leading to occasional 502 Bad Gateway responses?\n    - Enable retries\n- Is there an API endpoint that has a habit of either responding quickly or getting hung and not responding at all?\n    - Enable retries\n    - Set the timeout to be a little higher than its average response time (if 10 second default isn't sufficient)\n- Is there a cheeky developer who likes to use quirky or non-standard HTTP status codes (such as 418 I'm a Teapot) for client/server issues?\n    - Enable status exceptions which raises an exception for any status code \u003e=400\n    - You can also enable retries and expand the \"retry_status_forcelist\" parameter\n        - Any status code in \"retry_status_forcelist\" will issue retries\n        - All other status codes \u003e=400 will raise an exception\n        - Example: lets retry 418, but don't bother retrying for 411\n\n## Certificate Verification\n\nThis is enabled by default in both the default Session class and SessionPlus.  SessionPlus just provides an easy way to toggle it on and off globally.\n\nIt is not recommended to disable certificate verification but useful when working with HTTP endpoints which use a self-signed certificate or have some other certificate issue.  It both disables the [certificate check](https://requests.readthedocs.io/en/latest/user/advanced/#ssl-cert-verification) but also disables the warnings that bark at you when you disable certificate checks.\n\n**NOTE:** If [retries](#retries) are also enabled, retries will be issued for HTTP calls to servers that have bad certificates.\n\n## Configuring Certificate Verification\n\nParameter:\n - verify : boolean : verify certificate or not. Defaults to True\n\n```python\n\u003e\u003e\u003e from requests_session_plus import SessionPlus\n\u003e\u003e\u003e s = SessionPlus()  # enabled by default\n\u003e\u003e\u003e s = SessionPlus(verify=False)  # disable certificate verification\n```\n\nCertificate verification can be toggled on/off\n\n```python\n\u003e\u003e\u003e s = SessionPlus()  # enabled by default\n\u003e\u003e\u003e s.verify = False  # temporarily disable it\n\u003e\u003e\u003e # ... make 1 or more HTTP call to server with a bad certificate ...\n\u003e\u003e\u003e s.verify = True  # re-enable and continue\n```\n\nMaking an HTTP call to server with a bad cert\n\n```python\n\u003e\u003e\u003e s = SessionPlus()\n\u003e\u003e\u003e s.get(\"https://self-signed.badssl.com/\")\n# ... output compressed ...\n# SSLError exception thrown\nrequests.exceptions.SSLError: HTTPSConnectionPool(host='self-signed.badssl.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLcertificateVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate (_ssl.c:997)')))\n\u003e\u003e\u003e\n```\n\nSame results with retries enabled, it just takes longer as retries are performed with increasing backoff timer\n\n```python\n\u003e\u003e\u003e s = SessionPlus(retry=True)\n\u003e\u003e\u003e s.get(\"https://self-signed.badssl.com/\")\n# ... output compressed ...\n# SSLError exception thrown after 5 retries (default retry total)\nrequests.exceptions.SSLError: HTTPSConnectionPool(host='self-signed.badssl.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate (_ssl.c:997)')))\n```\n\nIf we utilize the requests way of disabling certificates, we get warnings\n\n```python\n\u003e\u003e\u003e s = SessionPlus()\n\u003e\u003e\u003e s.get(\"https://self-signed.badssl.com/\", verify=False)  # disable certificate verification\n# warnings are thrown\n/home/chambersh1129/Documents/code/personal/requests-session-plus/venv/lib/python3.10/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'self-signed.badssl.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n  warnings.warn(\n# but no exception is thrown\n\u003cResponse [200]\u003e\n```\n\nNow we can try it the SessionPlus way.  No exceptions, no warnings\n\n```python\n\u003e\u003e\u003e s = SessionPlus(verify=False)\n\u003e\u003e\u003e s.get(\"https://self-signed.badssl.com/\")\n\u003cResponse [200]\u003e\n```\n\n## Client/Server Error Exceptions\n\nThis is disabled by default in both the default Session class and SessionPlus and takes a few steps to enable with the default Session class.  SessionPlus just provides an easy way to toggle it on and off.\n\nSometimes you just want to know if the HTTP call worked or not instead of having a lot of conditionals checking the status code(s).  This setting will raise an exception if the status code is \u003e=400.  The status code will be provided in the error message if you still want to get the status code but you will not have access to the response object.\n\n**NOTE:** If [retries](#retries) are also enabled, certain status codes will issue a retry with a backoff timer.  These status codes are configurable with [retry_status_forcelist](#configuring-retries).\n\n## Configuring Client/Server Error Exceptions\n\nParameter:\n - status_exceptions : boolean : whether exceptions should be raised or not. Defaults to False\n\n```python\n\u003e\u003e\u003e from requests_session_plus import SessionPlus\n\u003e\u003e\u003e s = SessionPlus()  # disabled by default\n\u003e\u003e\u003e s = SessionPlus(status_exceptions=True)  # rase exception for status codes \u003e= 400\n```\n\nStatus exceptions can be toggled on/off\n\n```python\n\u003e\u003e\u003e s = SessionPlus(status_exceptions=True)  # raise exceptions\n\u003e\u003e\u003e s.status_exceptions = False  # disable temporarily\n\u003e\u003e\u003e # ... make HTTP call we want response object regardless of status code ...\n\u003e\u003e\u003e s.status_exceptions = True  # back to raising exceptions for status codes \u003e= 400\n```\n\nAn example, with status_exceptions and retries enabled.\n\n```python\n\u003e\u003e\u003e s = SessionPlus(status_exceptions=True, retries=True)\n\u003e\u003e\u003e s.get(\"https://httpstat.us/418/\")  # 418 I'm a teapot\n# ... output compressed ...\n# HTTPError exception thrown without retries\nrequests.exceptions.HTTPError: 418 Client Error: Im a teapot for url: https://httpstat.us/418/\n```\n\n**Note:** If both status_exceptions and retries are enabled and the status code is in [retry_status_forcelist](#configuring-retries), retries will be issued.  If this is unwanted behavior, retry_status_forcelist could be modified to be an empty list or set.\n\n```python\n\u003e\u003e\u003e s = SessionPlus(status_exceptions=True, retries=True)\n\u003e\u003e\u003e s.get(\"https://httpstat.us/429/\")  # 429 Too Many Requests\n# ... output compressed ...\n# RetryError exception thrown after 5 retries (default)\nrequests.exceptions.RetryError: HTTPSConnectionPool(host='httpstat.us', port=443): Max retries exceeded with url: /429/ (Caused by ResponseError('too many 429 error responses'))\n```\n\nIf we disable retries, we are back to the HTTPError we got with the 418.\n\n```python\n\u003e\u003e\u003e s = SessionPlus(status_exceptions=True)\n\u003e\u003e\u003e s.get(\"https://httpstat.us/429/\")  # 429 Too Many Requests\n# ... output compressed ...\n# HTTPError exception thrown without retries, same as the 418 above\nrequests.exceptions.HTTPError: 429 Client Error: Too Many Requests for url: https://httpstat.us/429/\n```\n\n## Retries\n\nThe default Session class does not perform retries, and when enabled a backoff of 0 is set meaning it does not wait between HTTP calls.\n\nRetries are helpful if the server uptime is spotty and the calls are idempotent.  Instead of setting a loop to try/fail/sleep/repeat (or worse, try/fail/break), SessionPlus will enable retries with some [helpful defaults](#configuring-retries).\n\n## When are Retries Performed?\n\nIf retries are enabled, they will be used for:\n - TimeoutErrors when timeoutes are enabled\n - SSLErrors when verify=True\n - For certain status codes set in retry_status_forcelist, even if status_exceptions=True\n\n The default status codes configured for retries in SessionPlus are:\n\n - [413 Payload Too Large](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/413)\n - [429 Too Many Requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429)\n - [500 Internal Server Error](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500)\n - [502 Bad Gateway](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502)\n - [503 Service Unavailable](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503)\n - [504 Gateway Timeout](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504)\n\n## How long will Retries Take?\n\nThere is a formula to determine how long to wait between retries (found in the [Retry docs](https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html#urllib3.util.Retry)):\n\n```\n{backoff factor} * (2 ** ({number of total retries} - 1))\n```\n\nExample #1\n- Parameters\n    - backoff_factor = 2 (SessionPlus default)\n    - total = 5 (SessionPlus default)\n    - timeout = 10 (SessionPlus default)\n    - server responds immediately with a 429 Too Many Requests so timeout does not come into play\n- Retries will be sent at\n    - 2s after the first failure\n    - 4s after the second failure\n    - 8s after the third failure\n    - 16s after the fourth failure\n    - 32s after the fifth failure\n\nA total of 62 seconds is spent trying to get a response.  The Too Many Requests issue might be resolved by then.\n\nExample #2\n- Parameters\n    - backoff_factor = 2 (SessionPlus default)\n    - total = 5 (SessionPlus default)\n    - timeout = 10 (SessionPlus default)\n    - server takes \u003e10 seconds to respond\n- Retries will be sent at\n    - 10s timeout + 2s after the first failure\n    - 10s timeout + 4s after the second failure\n    - 10s timeout + 8s after the third failure\n    - 10s timeout + 16s after the fourth failure\n    - 10s timeout + 32s after the fifth failure\n    - requests.exceptions.ReadTimeout exception is raised\n\nA total of 112 seconds is spent trying to get a response.  In this case, [disabling or increasing the timeout](#configuring-timeouts) could be useful.\n\nExample #3\n- Parameters\n    - backoff_factor = 10 (5x increase over SessionPlus default)\n    - total = 5 (SessionPlus default)\n    - timeout = 10 (SessionPlus default)\n    - server responds immediately with a 503 Service Unavailable\n- Retries will be sent at\n    - 10s after the first failure\n    - 20s after the second failure\n    - 40s after the third failure\n    - 80s after the fourth failure\n    - 160s after the fifth failure\n\nA total of 310 seconds is spent trying to get a response.  The Service Unavailable issue might be resolved by then.\n\n## Configuring Retries\n\nSessionPlus sets defaults for 3 specific parameters and there is a fourth parameter to enable/disable retries.  You can pass additional parameters for the retries by prepending \"retry_\" to them, a full list can be found in the [urllib3 Retry docs](https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html#urllib3.util.Retry).\n\n**NOTE**: Before altering the default values below be concious of how long the worst case HTTP call will take.  These defaults were chosen so the maximum time waiting for all retries is between 62 seconds (if server responds immediately) and 112 seconds (if timeouts are hit).  Increasing these values for performance or latency senstive applications could lead to issues.\n\nParameter:\n - retry : bool : enable or disable retry functionality. Defaults to False\n - retry_backoff_factor : float : used in the formula to determine how long to wait before retrying.  Defaults to 2\n - retry_status_forcelist : set : HTTP status codes to retry. Defaults to {413, 429, 500, 502, 503, 504}\n - retry_total: int : total number of retries before failing. Defaults to 5\n\n```python\n\u003e\u003e\u003e from requests_session_plus import SessionPlus\n\u003e\u003e\u003e s = SessionPlus()  # retries disabled by default\n\u003e\u003e\u003e s = SessionPlus(retry=True)  # enable retries\n```\n\nRetries can be toggled on/off\n\n```python\n\u003e\u003e\u003e s = SessionPlus(retry=True)\n\u003e\u003e\u003e s.retry = False  # retries are disabled\n\u003e\u003e\u003e # ... make HTTP call where retries aren't needed ...\n\u003e\u003e\u003e s.retry = True  # re-enable retries\n```\n\nViewing/Changing Retry Settings\n\n```python\n\u003e\u003e\u003e s = SessionPlus(retry=True)\n\u003e\u003e\u003e # view the settings\n\u003e\u003e\u003e s.retry_settings\n{'backoff_factor': 2, 'status_forcelist': {429, 500, 502, 503, 504, 413}, 'total': 5}\n\u003e\u003e\u003e # modify a default setting\n\u003e\u003e\u003e s.retry_total = 10\n\u003e\u003e\u003e s.retry_backoff_factor = 5\n\u003e\u003e\u003e s.retry_settings\n{'backoff_factor': 5.0, 'status_forcelist': {429, 500, 502, 503, 504, 413}, 'total': 10}\n\u003e\u003e\u003e # passing in new Retry settings.  Note: no validation is done for those not listed above in Parameters\n\u003e\u003e\u003e s.retry_raise_on_status = False\n\u003e\u003e\u003e s.retry_settings\n{'backoff_factor': 5.0, 'status_forcelist': {429, 500, 502, 503, 504, 413}, 'total': 10, 'raise_on_status': False}\n\u003e\u003e\u003e # initialize new session with all of these settings\n\u003e\u003e\u003e new_session = SessionPlus(retry=True, retry_raise_on_status=False, retry_total=10, retry_backoff_factor=5)\n\u003e\u003e\u003e new_session.retry_settings\n{'backoff_factor': 5.0, 'status_forcelist': {429, 500, 502, 503, 504, 413}, 'total': 10, 'raise_on_status': False}\n\u003e\u003e\u003e # settings persist, even when retries are disabled\n\u003e\u003e\u003e new_session.retry = False\n\u003e\u003e\u003e new_session.retry_settings\n{'backoff_factor': 5.0, 'status_forcelist': {429, 500, 502, 503, 504, 413}, 'total': 10, 'raise_on_status': False}\n```\n\nretry_status_forcelist is a set, so you need to use add, remove, or = to update it\n\n```python\n\u003e\u003e\u003e s = SessionPlus(retry=True)\n\u003e\u003e\u003e s.retry_status_forcelist\n{429, 500, 502, 503, 504, 413}\n\u003e\u003e\u003e # add a status code\n\u003e\u003e\u003e s.retry_status_forcelist.add(307)\n\u003e\u003e\u003e s.retry_status_forcelist\n{429, 307, 500, 502, 503, 504, 413}\n\u003e\u003e\u003e # remove a status code\n\u003e\u003e\u003e s.retry_status_forcelist.remove(502)\n\u003e\u003e\u003e s.retry_status_forcelist\n{429, 307, 500, 503, 504, 413}\n\u003e\u003e\u003e # update entire set.  Can be set or list of integers\n\u003e\u003e\u003e s.retry_status_forcelist = {418}\n\u003e\u003e\u003e s.retry_status_forcelist\n{418}\n```\n\nFor the retry settings to be completed updated, you need to run .update_retry().  This is done automatically when enabling/disabling retries, this is just a helper method to run if you need to change an existing enabled retry.\n\n```python\n\u003e\u003e\u003e s = SessionPlus(retry=True)\n\u003e\u003e\u003e s.retry_settings\n{'backoff_factor': 2, 'status_forcelist': {429, 500, 502, 503, 504, 413}, 'total': 5}\n\u003e\u003e\u003e # update the settings\n\u003e\u003e\u003e s.retry_total = 10\n\u003e\u003e\u003e s.retry_settings\n{'backoff_factor': 2, 'status_forcelist': {429, 500, 502, 503, 504, 413}, 'total': 10}\n\u003e\u003e\u003e # apply the settings\n\u003e\u003e\u003e s.update_retry()\n```\n\nFor the parameters SessionPlus has defaults for, there is also input validation.  Other parameters are passed straight to the Retry object.\n\n```python\n\u003e\u003e\u003e s = SessionPlus(retry=True)\n\u003e\u003e\u003e s.retry_status_forcelist = 429\nTraceback (most recent call last):\n  File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\n  File \"/home/chambersh1129/Documents/code/personal/requests-session-plus/requests_session_plus/__init__.py\", line 68, in __init__\n    self.retry_status_forcelist = retry_status_forcelist\n  File \"/home/chambersh1129/Documents/code/personal/requests-session-plus/requests_session_plus/__init__.py\", line 123, in retry_status_forcelist\n    raise ValueError(\"retry_status_forcelist must be a set of integers\")\nValueError: retry_status_forcelist must be a set of integers\n\u003e\u003e\u003e\n\u003e\u003e\u003e s.retry_read = \"this should be an integer\"\n\u003e\u003e\u003e s.update_retry()\n\u003e\u003e\u003e s.get(\"https://httpstat.us/429/\")  # 429 Too Many Requests\n# ... output compressed ...\n# TypeError exception thrown when first retry is attempted\nTypeError: '\u003c' not supported between instances of 'str' and 'int'\n```\n\n## Timeouts\n\nSome HTTP calls should only take X amount of time, and if it takes longer the server is likely hung or some other issue.  Timeouts allow you to set a maximum time to wait before declaring the server unresponsive and moving on.\n\nThe default Session class supports timeouts per HTTP call, SessionPlus just provides the ability to set it globally in addition to per call.\n\n## Configuring Timeouts\n\nParameter:\n - timeout : [float,None] : how long to wait, in seconds, before raising an exception. Defaults to 10\n\n```python\n\u003e\u003e\u003e from requests_session_plus import SessionPlus\n\u003e\u003e\u003e s = SessionPlus()  # timeout set to 10 seconds\n\u003e\u003e\u003e s = SessionPlus(timeout=None)  # disable the timeout\n```\n\nGlobal Timeout can be toggled on/off\n\n```python\n\u003e\u003e\u003e s = SessionPlus()  # timeout set to 10 seconds\n\u003e\u003e\u003e s.timeout = None  # now no call has a timeout\n\u003e\u003e\u003e # ... make a really long HTTP call ...\n\u003e\u003e\u003e s.timeout = 30  # set it back to whatever you want\n```\n\nYou can still overwite it per call and the default value is maintained for future calls\n\n```python\n\u003e\u003e\u003e s = SessionPlus(timeout=1)\n\u003e\u003e\u003e s.get(\"https://httpstat.us/200/?sleep=1250\")  # 200 OK that takes 1.25 seconds to respond\n# ... ouput compressed ...\n# TimeoutError triggers a ReadTimeoutError which triggers a MaxRetryError and eventually a ConnectionError\nrequests.exceptions.ConnectionError: HTTPSConnectionPool(host='httpstat.us', port=443): Max retries exceeded with url: /200/?sleep=1250 (Caused by ReadTimeoutError(\"HTTPSConnectionPool(host='httpstat.us', port=4\n43): Read timed out. (read timeout=1.0)\"))\n\u003e\u003e\u003e\n\u003e\u003e\u003e # disable retries and try again\n\u003e\u003e\u003e s.retry = False\n# ... output compressed ...\n# TimeoutError triggers a ReadTimeoutError which triggers a ReadTimeout\nrequests.exceptions.ReadTimeout: HTTPSConnectionPool(host='httpstat.us', port=443): Read timed out. (read timeout=1.0)\n\u003e\u003e\u003e\n\u003e\u003e\u003e # increase the timeout for this call only\n\u003e\u003e\u003e s.timeout\n1.0\n\u003e\u003e\u003e # make the call again, overwriting global timeout\n\u003e\u003e\u003e s.get(\"https://httpstat.us/200/?sleep=1250\", timeout=2)  # 200 OK that takes 1.25 seconds to respond\n\u003cResponse [200]\u003e\n\u003e\u003e\u003e # global is unchanged\n\u003e\u003e\u003e s.timeout\n1.0\n```\n\n**NOTE:** Once again, disabling timeouts isn't a silver bullet.  Other timeouts come into play, both at the python level (urllib3 timeouts, socket timeouts) or at the server level (NGINX proxy_read_timeout for example).  Setting timeout=None for an HTTP call does not guarantee exceptions aren't raised.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchambersh1129%2Frequests-session-plus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchambersh1129%2Frequests-session-plus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchambersh1129%2Frequests-session-plus/lists"}