Reduce the access frequency of the Amap API.

This commit is contained in:
huafengchun
2025-01-26 03:51:17 +00:00
parent 274714f870
commit de9fba1326
3 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -6,6 +6,6 @@ RUN apt update && apt install -y python3 python3-pip
COPY * /root/app
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r /root/app/requirements.txt
RUN pip install -r /root/app/requirements.txt
ENTRYPOINT ["python3", "/root/app/teslamate_fix_addrs.py"]
+3 -3
View File
@@ -1,4 +1,4 @@
Requests==2.31.0
SQLAlchemy==2.0.24
psycopg2-binary==2.9.9
Requests
SQLAlchemy
psycopg2-binary
pysocks
+4
View File
@@ -11,6 +11,7 @@ import argparse
import os
import signal
from threading import Timer
import time
logging.basicConfig(
level=logging.INFO,
@@ -549,6 +550,9 @@ def request_amap_api(url):
response = http_request(url)
if response is None:
return None
else:
# amap limits access frequency
time.sleep(0.3)
response_dict = json.loads(response)
if response_dict is None or response_dict['status'] != '1':