handle Timeout exception as ReadTimeout has been introduced in recent versions of requests

This commit is contained in:
Romain Bignon 2015-02-21 18:02:32 +01:00
commit e835e61d0a

View file

@ -18,12 +18,13 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from requests.exceptions import Timeout
from weboob.browser import LoginBrowser, URL, need_login from weboob.browser import LoginBrowser, URL, need_login
from weboob.browser.exceptions import ServerError, HTTPNotFound from weboob.browser.exceptions import ServerError, HTTPNotFound
from weboob.capabilities.base import Currency from weboob.capabilities.base import Currency
from weboob.capabilities.shop import OrderNotFound from weboob.capabilities.shop import OrderNotFound
from weboob.exceptions import BrowserIncorrectPassword from weboob.exceptions import BrowserIncorrectPassword
from requests.exceptions import ReadTimeout
from .pages import HomePage, LoginPage, AmazonPage, HistoryPage, \ from .pages import HomePage, LoginPage, AmazonPage, HistoryPage, \
OrderOldPage, OrderNewPage OrderOldPage, OrderNewPage
@ -108,6 +109,6 @@ class Amazon(LoginBrowser):
for i in xrange(self.MAX_RETRIES): for i in xrange(self.MAX_RETRIES):
try: try:
return super(Amazon, self).location(*args, **kwargs) return super(Amazon, self).location(*args, **kwargs)
except (ServerError, ReadTimeout) as e: except (ServerError, Timeout) as e:
pass pass
raise e raise e