[pixiv] fix KeyError if no status is present

This commit is contained in:
Mike Fährmann 2016-08-28 16:49:49 +02:00
parent effa1084f2
commit 30d10cf595
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -306,6 +306,6 @@ class PixivAPI():
def _parse(response, empty=[None]):
"""Parse a Pixiv Public-API response"""
data = json.loads(response.text)
if data["status"] == "failure" or data["response"] == empty:
if data.get("status") == "failure" or data.get("response", empty) == empty:
raise exception.NotFoundError()
return data