summaryrefslogtreecommitdiff
path: root/crawler.py
diff options
context:
space:
mode:
authorschneefux <schneefux+github@schneefux.xyz>2017-02-28 19:18:16 +0100
committerGitHub <noreply@github.com>2017-02-28 19:18:16 +0100
commit44cce86f114a276f3cc9e386ab7bdb5459bfe048 (patch)
tree3cc36389691c94677fc62f945336f390dd6c1bb7 /crawler.py
parent235ded9c57471a30f7d8c6237fc6b39227dc7ec1 (diff)
downloadapigrabber-44cce86f114a276f3cc9e386ab7bdb5459bfe048.tar.gz
apigrabber-44cce86f114a276f3cc9e386ab7bdb5459bfe048.zip
set api pagelimit to maximum (#49)
* set api pagelimit to maximum * don't fail with 404 if a player was found
Diffstat (limited to 'crawler.py')
-rw-r--r--crawler.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/crawler.py b/crawler.py
index f31c99a..6a588c7 100644
--- a/crawler.py
+++ b/crawler.py
@@ -15,7 +15,7 @@ class Crawler(object):
"""Sets constants."""
self._apiurl = APIURL
self._token = token
- self._pagelimit = 5
+ self._pagelimit = 50
async def _req(self, session, path, params):
"""Sends an API request and returns the response dict.
@@ -71,6 +71,11 @@ class Crawler(object):
if "errors" in res:
logging.warn("API returned error: '%s'",
res["errors"])
+ if res["errors"][0].get("title") == "Not Found" \
+ and params["page[offset]"] > 0:
+ # a query returned exactly 50 matches
+ # which is expected, so don't fail.
+ return
raise ApiError(res["errors"])
yield res