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

Fix default retry backoff factor #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 robobrowser/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class RoboBrowser(object):
def __init__(self, session=None, parser=None, user_agent=None,
history=True, timeout=None, allow_redirects=True, cache=False,
cache_patterns=None, max_age=None, max_count=None, tries=None,
multiplier=None):
multiplier=0):

self.session = session or requests.Session()

Expand Down
9 changes: 9 additions & 0 deletions tests/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,3 +343,12 @@ def test_call_allow_redirects(self, mock_request):
assert_true(mock_request.called)
kwargs = mock_request.mock_calls[0][2]
assert_true(kwargs.get('allow_redirects') is False)


class TestRetry(unittest.TestCase):

def test_default_backoff_factor_not_none(self):
session = RoboBrowser(tries=3).session
for protocol in session.adapters:
factor = session.adapters[protocol].max_retries.backoff_factor
assert_true(factor is not None)