jmcarp / jmcarp/robobrowser

TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

Open
#76 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3.7k
Forks
336
PR merge metrics
No merged PRs in 30d

Description

The bug is impacting RoboBrowser 0.5.3 used with Python 3.4.1

robobrowser/browser.py 's __init__ is setting "self.session.adapters[protocol].max_retries" to an instance of requests.packages.urllib3.util.retry.Retry

However, Python3's urlopen() in urllib3/connectionpool.py is doing a comparison "if not isinstance(retries, Retry)" where Retry is actually 'urllib3.util.retry.Retry', leading to the exception later on.

A temporary workaround for RoboBrowser users:
```
from urllib3.util.retry import Retry
br = RoboBrowser(parser='html.parser', tries=9999, timeout=25)

retry = Retry(9999, backoff_factor=1)
for protocol in ['http://', 'https://']:
br.session.adapters[protocol].max_retries = retry
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.