diff --git a/data/wallamanta.db b/data/wallamanta.db new file mode 100644 index 0000000..7e9cbfc Binary files /dev/null and b/data/wallamanta.db differ diff --git a/wallamanta/worker.py b/wallamanta/worker.py index aa4d50f..63431d7 100644 --- a/wallamanta/worker.py +++ b/wallamanta/worker.py @@ -34,16 +34,18 @@ class Worker: if condition != "all": url = url + f"&condition={condition}" # new, as_good_as_new, good, fair, has_given_it_all - while True: - response = requests.get(url) - try: - if response.status_code == 200: - break - else: - logging.info(f"\'{product_name}\' -> Wallapop returned status {response.status_code}. Illegal parameters or Wallapop service is down. Retrying...") - except Exception as e: - logging.info("Exception: " + e) - time.sleep(3) + for step in range(15): + while True: + time.sleep(0.5) + response = requests.get(url+f"&step={step+1}") + try: + if response.status_code == 200: + break + else: + logging.info(f"\'{product_name}\' -> Wallapop returned status {response.status_code}. Illegal parameters or Wallapop service is down. Retrying...") + except Exception as e: + logging.info("Exception: " + e) + time.sleep(3) json_data = response.json() return json_data['search_objects']