Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Update urllib version" #1138

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion osbs/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
HTTP_RETRIES_STATUS_FORCELIST = [408, 500, 502, 503, 504]

# HTTP methods that we should retry on
HTTP_RETRIES_ALLOWED_METHODS = ['GET', 'PUT', 'POST', 'DELETE']
HTTP_RETRIES_METHODS_WHITELIST = ['GET', 'PUT', 'POST', 'DELETE']

# requests timeout in seconds
HTTP_REQUEST_TIMEOUT = 600
Expand Down
4 changes: 2 additions & 2 deletions osbs/osbs_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from osbs.exceptions import OsbsException, OsbsNetworkException, OsbsResponseException
from osbs.constants import (
HTTP_MAX_RETRIES, HTTP_BACKOFF_FACTOR, HTTP_RETRIES_STATUS_FORCELIST,
HTTP_RETRIES_ALLOWED_METHODS, HTTP_REQUEST_TIMEOUT)
HTTP_RETRIES_METHODS_WHITELIST, HTTP_REQUEST_TIMEOUT)

import requests
from requests.adapters import HTTPAdapter
Expand Down Expand Up @@ -111,7 +111,7 @@ def log_error_response_text_hook(resp, *args, **kwargs):
read=HTTP_MAX_RETRIES,
backoff_factor=HTTP_BACKOFF_FACTOR,
status_forcelist=HTTP_RETRIES_STATUS_FORCELIST,
allowed_methods=HTTP_RETRIES_ALLOWED_METHODS,
method_whitelist=HTTP_RETRIES_METHODS_WHITELIST,
raise_on_status=False,
)
self.session = requests.Session()
Expand Down
2 changes: 1 addition & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
flexmock>=0.11.0
urllib3>=1.26.19
urllib3<1.26
pytest==7.0.1
pytest-cov
pytest-html
Expand Down
4 changes: 2 additions & 2 deletions tests/test_retries.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import requests
from urllib3.util import Retry
from osbs.exceptions import OsbsNetworkException, OsbsResponseException
from osbs.constants import HTTP_RETRIES_STATUS_FORCELIST, HTTP_RETRIES_ALLOWED_METHODS
from osbs.constants import HTTP_RETRIES_STATUS_FORCELIST, HTTP_RETRIES_METHODS_WHITELIST
from osbs.osbs_http import HttpSession, HttpStream
from osbs import osbs_http
logger = logging.getLogger(__file__)
Expand Down Expand Up @@ -49,7 +49,7 @@ def has_connection():
reason="requires internet connection")
class TestHttpRetries(object):
@pytest.mark.parametrize('status_code', HTTP_RETRIES_STATUS_FORCELIST)
@pytest.mark.parametrize('method', HTTP_RETRIES_ALLOWED_METHODS)
@pytest.mark.parametrize('method', HTTP_RETRIES_METHODS_WHITELIST)
def test_fail_after_retries(self, s, status_code, method):
flexmock(osbs_http).should_receive('Retry').and_return(fake_retry)
# latest python-requests throws OsbsResponseException, 2.6.x - OsbsNetworkException
Expand Down