Skip to content

Commit

Permalink
Update docs on retries to retry POST requests (#561)
Browse files Browse the repository at this point in the history
* Update docs on retries to retry POST requests

This updates the usage docs to set `allowed_methods=False`. The
motivation is to retry on `POST` requests to `search` and pagination
methods. By default, requests / urllib3 only retry on

    {'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PUT', 'TRACE'}

https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html#urllib3.util.Retry.DEFAULT_ALLOWED_METHODS

* fix: use `None` instead of `False` for `allowed_methods`

---------

Co-authored-by: Pete Gadomski <pete.gadomski@gmail.com>
  • Loading branch information
Tom Augspurger and gadomski committed Aug 4, 2023
1 parent ed70437 commit 9c4dc6e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ If you'd like to configure this behavior, e.g. to retry on some ``50x`` response
from pystac_client import Client
from pystac_client.stac_api_io import StacApiIO
retry = Retry(total=5, backoff_factor=1, status_forcelist=[502, 503, 504])
retry = Retry(
total=5, backoff_factor=1, status_forcelist=[502, 503, 504], allowed_methods=None
)
stac_api_io = StacApiIO()
stac_api_io.session.mount("https://", HTTPAdapter(max_retries=retry))
client = Client.open(
Expand Down

0 comments on commit 9c4dc6e

Please sign in to comment.