From e6b71c6ed51c5d6070f06422f86d6a8298efca67 Mon Sep 17 00:00:00 2001 From: Gautier P Date: Mon, 18 Jan 2021 13:13:02 +0100 Subject: [PATCH] Sleep when querying leboncoin --- flatisfy/cmds.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flatisfy/cmds.py b/flatisfy/cmds.py index 89ea505..e67445b 100644 --- a/flatisfy/cmds.py +++ b/flatisfy/cmds.py @@ -18,7 +18,7 @@ from flatisfy import fetch from flatisfy import tools from flatisfy.filters import metadata from flatisfy.web import app as web_app - +import time LOGGER = logging.getLogger(__name__) @@ -69,6 +69,10 @@ def filter_flats_list(config, constraint_name, flats_list, fetch_details=True): for i, flat in enumerate(first_pass_result["new"]): details = fetch.fetch_details(config, flat["id"]) first_pass_result["new"][i] = tools.merge_dicts(flat, details) + if flat["id"].endswith("@leboncoin"): + # sleep 0.5s to avoid rate-kick + time.sleep(0.5) + # Do a second pass to consolidate all the infos we found and make use of # additional infos