diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-02-08 18:56:30 +0100 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-02-08 18:57:05 +0100 |
| commit | 64c9a5de92934a1f779a747123f433bb2c7e1bcf (patch) | |
| tree | bcf2d8ec445e79cb7a97bb7c9e9ecbee14ba0a06 | |
| parent | daa2c59cd8b56d4f5bdec85d7421cf8f7827a908 (diff) | |
| download | apigrabber-64c9a5de92934a1f779a747123f433bb2c7e1bcf.tar.gz apigrabber-64c9a5de92934a1f779a747123f433bb2c7e1bcf.zip | |
tolerate connection errors
| -rw-r--r-- | api.py | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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: |
