summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-02-08 18:56:30 +0100
committerschneefux <schneefux+commit@schneefux.xyz>2017-02-08 18:57:05 +0100
commit64c9a5de92934a1f779a747123f433bb2c7e1bcf (patch)
treebcf2d8ec445e79cb7a97bb7c9e9ecbee14ba0a06
parentdaa2c59cd8b56d4f5bdec85d7421cf8f7827a908 (diff)
downloadapigrabber-64c9a5de92934a1f779a747123f433bb2c7e1bcf.tar.gz
apigrabber-64c9a5de92934a1f779a747123f433bb2c7e1bcf.zip
tolerate connection errors
-rw-r--r--api.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/api.py b/api.py
index 9e5a8d7..7843f12 100644
--- a/api.py
+++ b/api.py
@@ -34,9 +34,14 @@ async def crawl_region(region):
region, last_match_update)
# wait for http requests
- matches = await api.matches_since(last_match_update,
- region=region,
- params={"page[limit]": 50})
+ try:
+ matches = await api.matches_since(last_match_update,
+ region=region,
+ params={"page[limit]": 50})
+ except:
+ logging.error("%s: connection error, retrying", region)
+ await asyncio.sleep(5)
+
if len(matches) > 0:
logging.debug("%s: %s objects", region, len(matches))
else: