[pixiv] fix KeyError if no status is present
This commit is contained in:
@@ -306,6 +306,6 @@ class PixivAPI():
|
|||||||
def _parse(response, empty=[None]):
|
def _parse(response, empty=[None]):
|
||||||
"""Parse a Pixiv Public-API response"""
|
"""Parse a Pixiv Public-API response"""
|
||||||
data = json.loads(response.text)
|
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()
|
raise exception.NotFoundError()
|
||||||
return data
|
return data
|
||||||
|
|||||||
Reference in New Issue
Block a user