{"id":21385155,"url":"https://github.com/spoqa/requests-backoff","last_synced_at":"2025-03-16T11:44:17.674Z","repository":{"id":57470282,"uuid":"344715112","full_name":"spoqa/requests-backoff","owner":"spoqa","description":"Backoff session for requests","archived":false,"fork":false,"pushed_at":"2021-04-02T07:49:30.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-02-22T19:47:35.012Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spoqa.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}},"created_at":"2021-03-05T06:22:40.000Z","updated_at":"2021-04-02T07:49:23.000Z","dependencies_parsed_at":"2022-09-19T10:21:36.275Z","dependency_job_id":null,"html_url":"https://github.com/spoqa/requests-backoff","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spoqa%2Frequests-backoff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spoqa%2Frequests-backoff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spoqa%2Frequests-backoff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spoqa%2Frequests-backoff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spoqa","download_url":"https://codeload.github.com/spoqa/requests-backoff/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243864626,"owners_count":20360355,"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":[],"created_at":"2024-11-22T11:45:19.912Z","updated_at":"2025-03-16T11:44:17.651Z","avatar_url":"https://github.com/spoqa.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spoqa-requests-backoff\n\n[![MIT License](https://badgen.net/badge/license/MIT/cyan)](LICENSE)\n[![PyPI](https://badgen.net/pypi/v/spoqa-requests-backoff)](https://pypi.org/project/spoqa-requests-backoff/)\n\nBackoff session for requests\n\n## Usage\n\n```python\nresp = BackoffSession().get('https://...')\n```\n\nBy default, `BackoffSession` tries before giving up until any following condition is met:\n\n- Tries 10 times\n- Reaches 20 seconds\n- Meets `requests.RequestException`\n- Meets HTTP client error (4xx)\n\nBehaviors above can be customized with parameters.\n\n```python\nBackoffSession(\n    exception=(RequestException, ValueError),  # Give up when ValueError occurs, too.\n    max_tries=100,  # Tries 100 times before giving up\n    max_time=300,  # Wait until maximum 300 seconds before giving up\n    giveup=lambda e: e.response.text == 'You're fired!'  # Give up when specific response is met\n)\n```\n\nBackoffSession heavily depends on [`backoff`](https://github.com/litl/backoff) package.\n\n## License\n\n_spoqa-requests-backoff_ is distributed under the terms of MIT License.\n\nSee [LICENSE](LICENSE) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspoqa%2Frequests-backoff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspoqa%2Frequests-backoff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspoqa%2Frequests-backoff/lists"}