diff options
| author | schneefux <schneefux+github@schneefux.xyz> | 2017-02-28 19:18:16 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-28 19:18:16 +0100 |
| commit | 44cce86f114a276f3cc9e386ab7bdb5459bfe048 (patch) | |
| tree | 3cc36389691c94677fc62f945336f390dd6c1bb7 /crawler.py | |
| parent | 235ded9c57471a30f7d8c6237fc6b39227dc7ec1 (diff) | |
| download | apigrabber-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.py | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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 |
