Added step parameter to API queries
This commit is contained in:
BIN
data/wallamanta.db
Normal file
BIN
data/wallamanta.db
Normal file
Binary file not shown.
@@ -34,16 +34,18 @@ class Worker:
|
|||||||
if condition != "all":
|
if condition != "all":
|
||||||
url = url + f"&condition={condition}" # new, as_good_as_new, good, fair, has_given_it_all
|
url = url + f"&condition={condition}" # new, as_good_as_new, good, fair, has_given_it_all
|
||||||
|
|
||||||
while True:
|
for step in range(15):
|
||||||
response = requests.get(url)
|
while True:
|
||||||
try:
|
time.sleep(0.5)
|
||||||
if response.status_code == 200:
|
response = requests.get(url+f"&step={step+1}")
|
||||||
break
|
try:
|
||||||
else:
|
if response.status_code == 200:
|
||||||
logging.info(f"\'{product_name}\' -> Wallapop returned status {response.status_code}. Illegal parameters or Wallapop service is down. Retrying...")
|
break
|
||||||
except Exception as e:
|
else:
|
||||||
logging.info("Exception: " + e)
|
logging.info(f"\'{product_name}\' -> Wallapop returned status {response.status_code}. Illegal parameters or Wallapop service is down. Retrying...")
|
||||||
time.sleep(3)
|
except Exception as e:
|
||||||
|
logging.info("Exception: " + e)
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
json_data = response.json()
|
json_data = response.json()
|
||||||
return json_data['search_objects']
|
return json_data['search_objects']
|
||||||
|
|||||||
Reference in New Issue
Block a user