Skip to content

Commit

Permalink
Set "allowed_methods" argument name
Browse files Browse the repository at this point in the history
* Fix change related to urllib3 v2: urllib3/urllib3#2086
* Set minimum urllib3 dependency
* Bump version to 2.0.0
  • Loading branch information
Marcelo Parada authored and bustawin committed May 28, 2023
1 parent ff99b06 commit 543ceaf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion retry_requests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def retry(
session = session or TSession()

# Retry too in non-idempotent methods like POST
kwargs.setdefault("method_whitelist", False)
kwargs.setdefault("allowed_methods", None)

r = Retry(
total=retries,
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="retry-requests",
version="1.0.1",
version="2.0.0",
url="https://github.com/bustawin/retry-requests",
project_urls={
"Documentation": "https://github.com/bustawin/retry-requests",
Expand All @@ -20,7 +20,7 @@
packages=find_packages(),
python_requires=">=3.6",
long_description=Path("README.rst").read_text("utf8"),
install_requires=["requests"],
install_requires=["requests", "urllib3>=1.26"],
extras_require={"test": test_requires},
tests_require=test_requires,
setup_requires=["pytest-runner"],
Expand Down
7 changes: 7 additions & 0 deletions tests/test_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ def test_retry_failure(caplog):
)


def test_retry_failure_post(caplog):
"""Retries in a non-idempotent method such as a POST."""
session = retry(session=RSession(), status_to_retry=(200,), retries=1)
with pytest.raises(requests.exceptions.RetryError):
session.post("http://example.com")


def test_retry_success():
"""Gets a successful URL."""
session = retry()
Expand Down

0 comments on commit 543ceaf

Please sign in to comment.