You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-9Lines changed: 8 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,22 +19,21 @@ Several HTTP errors are often transient, and might succeed if retried:
19
19
20
20
This project aims to simplify retrying these, by extending [`tenacity`](https://tenacity.readthedocs.io/) with custom retry and wait strategies, as well as a custom decorator. Defaults are sensible for most use cases, but are fully customizable.
21
21
22
-
Supports exceptions raised by both [`requests`](https://docs.python-requests.org/en/latest/index.html) and [`httpx`](https://python-httpx.org/).
22
+
Supports both [`requests`](https://docs.python-requests.org/en/latest/index.html) and [`httpx`](https://python-httpx.org/) natively, but could be customized to use with any library that raises exceptions for the conditions listed above.
23
23
24
24
## Install
25
25
26
26
Install from PyPI:
27
27
28
28
```sh
29
-
# Supports both HTTPX and requests
30
-
pip install retryhttp
29
+
pip install retryhttp # Supports both HTTPX and requests
31
30
```
32
31
33
-
You can also install support for only HTTPX or requests:
32
+
You can also install support for only HTTPX or requests, if you would rather not install unnecessary dependencies:
34
33
35
34
```sh
36
-
pip install retryhttp[httpx] # Supports only HTTPX
37
-
pip install retryhttp[requests] # Supports only requests
35
+
pip install retryhttp[httpx] # Supports only HTTPX
36
+
pip install retryhttp[requests] # Supports only requests
38
37
```
39
38
40
39
Or, install the latest development snapshot from git:
# and timeouts, up to a total of 3 times, with appropriate wait strategies for each
54
53
# type of error. All of these behaviors are customizable.
55
54
@retry
56
55
defexample():
@@ -62,4 +61,4 @@ def example():
62
61
63
62
## Contributing
64
63
65
-
Contributions welcome! Open a discussion and let's chat about your idea. Looking forward to working with you!
64
+
Contributions welcome! Bug fixes and minor tweaks can jump straight to a [pull request](https://github.com/austind/retryhttp/compare). For more involved changes, [open an issue](https://github.com/austind/retryhttp/issues/new/choose)and let's chat about your idea. Thanks for your contribution!
Copy file name to clipboardExpand all lines: docs/changelog.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,9 @@
1
1
# Changelog
2
2
3
+
## v1.3.2
4
+
5
+
* Bugfix: Don't pass `stop`, `wait`, and `retry` keyword arguments from [`retryhttp.retry`][] on to `tenacity.retry()` ([#23](https://github.com/austind/retryhttp/issues/23))
6
+
3
7
## v1.3.1
4
8
5
9
* Fixed all outstanding mypy errors. ([#20](https://github.com/austind/retryhttp/issues/20)
Copy file name to clipboardExpand all lines: docs/guide.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,6 +53,9 @@ def get_example():
53
53
response.raise_for_status()
54
54
```
55
55
56
+
!!! note
57
+
`retryhttp` works by catching exceptions, so your code must raise those exceptions. Most of the time, all you need is to call `response.raise_for_status()`. Be sure not to catch those exceptions in your own `try..except` block.
58
+
56
59
## Advanced Usage
57
60
58
61
You don't have to use the [`retryhttp.retry`][] decorator, which is provided purely for convenience. If you prefer, you can use [`tenacity.retry`](https://tenacity.readthedocs.io/en/latest/api.html#tenacity.retry) and roll your own approach.
0 commit comments