From c396f7ba1fca25b97f609ded96efbcf704463dbe Mon Sep 17 00:00:00 2001 From: Joan Cano Date: Tue, 7 Mar 2023 11:18:55 +0100 Subject: [PATCH] Added step parameter to API queries --- data/wallamanta.db | Bin 0 -> 12288 bytes wallamanta/worker.py | 22 ++++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) create mode 100644 data/wallamanta.db diff --git a/data/wallamanta.db b/data/wallamanta.db new file mode 100644 index 0000000000000000000000000000000000000000..7e9cbfc211e09402237064a8a15a937a2ac32f56 GIT binary patch literal 12288 zcmeI#&q~8E90%~E8*VaYg&{o+0wQcMMyES?bd#OjMcq*-v5g~;wxi8t*WnX*^;Psm zcJMj8nszJ9fj3X{8}jFug#6(5x#j+LEVW=yaT0RPF32&Vlw2`J2&tM;GNWjg3ChLB ztaK~>Ev%C6&1>DH2Oon2gwDFdUCqaoXAhUc^JuVS!9Fk9-sDHpR8n^T6DwIGS!kKaK*a zWgK-_C?ju{$n0sz7e%<6#pF=J6ANGEsn**-q<$i2S)Q#cp~N)dp*K%O;>n;rqz8`U zP>~mx9j5tY{U|FxYU!P~9mahvpG7 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']