From 41278a1d9b1218bc13e06764d6e43e4069633ac8 Mon Sep 17 00:00:00 2001 From: Florent Date: Tue, 7 Jan 2014 14:37:56 +0100 Subject: [PATCH] Test if banned closes #1321 --- modules/colissimo/browser.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/colissimo/browser.py b/modules/colissimo/browser.py index e1626da6..bbf75284 100644 --- a/modules/colissimo/browser.py +++ b/modules/colissimo/browser.py @@ -18,7 +18,7 @@ # along with weboob. If not, see . from weboob.tools.json import json -from weboob.tools.browser import BaseBrowser +from weboob.tools.browser import BaseBrowser, BrowserBanned __all__ = ['ColissimoBrowser'] @@ -34,4 +34,6 @@ class ColissimoBrowser(BaseBrowser): def get_tracking_info(self, _id): json_data = self.readurl('/outilsuivi/web/suiviInterMetiers.php?key=%s&method=json&code=%s' % (self.api_key, _id)) + if json_data is None: + raise BrowserBanned('You are banned of the colissimo API (too many requests from your IP)') return json.loads(json_data)