diff options
| author | Vainsocial root <root@vainsocial> | 2017-03-12 10:18:44 +0000 |
|---|---|---|
| committer | Vainsocial root <root@vainsocial> | 2017-03-12 10:18:44 +0000 |
| commit | 6186dbc0e46df0d4e55f2f8bb179489ae00bfe41 (patch) | |
| tree | 59cc8dc914c1d39aba232b68c60a47856a2a5b45 | |
| parent | c9f85ce2e0a98df5b15e4ddb4cb18c32e1ea7058 (diff) | |
| download | apigrabber-6186dbc0e46df0d4e55f2f8bb179489ae00bfe41.tar.gz apigrabber-6186dbc0e46df0d4e55f2f8bb179489ae00bfe41.zip | |
hotfix: do not retry forever
| -rw-r--r-- | crawler.py | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -36,6 +36,7 @@ class Crawler(object): "Accept": "application/vnd.api+json", "Accept-Encoding": "gzip" } + retries = 5 while True: try: async with session.get(self._apiurl + path, headers=headers, @@ -57,6 +58,11 @@ class Crawler(object): json.decoder.JSONDecodeError) as err: # API bug? logging.error("API error '%s', retrying", err) + retries -= 1 + if retries == 0: + logging.error("Giving up") + raise ApiError(err) + await asyncio.sleep(5) async def matches(self, params, region="na"): |
