replace extractor.request() 'expect' argument
with - 'fatal': allow 4xx status codes - 'notfound': raise NotFoundError on 404
This commit is contained in:
@@ -228,14 +228,14 @@ class PinterestAPI():
|
||||
params = {"data": json.dumps({"options": options}), "source_url": ""}
|
||||
|
||||
response = self.extractor.request(
|
||||
url, params=params, headers=self.HEADERS, expect=range(400, 500))
|
||||
url, params=params, headers=self.HEADERS, fatal=False)
|
||||
|
||||
try:
|
||||
data = response.json()
|
||||
except ValueError:
|
||||
data = {}
|
||||
|
||||
if 200 <= response.status_code < 400 and not response.history:
|
||||
if response.status_code < 400 and not response.history:
|
||||
return data
|
||||
|
||||
if response.status_code == 404 or response.history:
|
||||
|
||||
Reference in New Issue
Block a user