1
0

Обновить yandex_way_mp.py

This commit is contained in:
lukas91 2024-06-12 12:30:00 +05:00
parent 925aee9132
commit b07a094f34

View File

@ -67,7 +67,7 @@ def process_records(records, apikey, queue):
origins = f"{record[2]},{record[3]}"
destinations = f"{record[5]},{record[6]}"
params = {'origins': origins, 'destinations': destinations, 'apikey': apikey, 'departure_time': dep_time}
response = requests.get('https://api.routing.yandex.net/v2/distancematrix', params=params)
response = requests.get('https://api.routing.yandex.net/v2/distancematrix', params=params, timeout=5)
route_json = response.json()
cursor.execute("BEGIN flm_office.add_way_log(:1, :2, :3, :4); END;",
[record[0], response.status_code, response.url, json.dumps(route_json)])
@ -123,9 +123,9 @@ def process_data():
terminate_processes(processes)
processes.clear()
start_next_pool = 10
logging.info(f"End pool, wait {start_next_pool} seconds")
time.sleep(start_next_pool)
# start_next_pool = 10
# logging.info(f"End pool, wait {start_next_pool} seconds")
# time.sleep(start_next_pool)
terminate_processes(processes)
processes.clear()