mirror of
https://github.com/hipudding/teslamate_fix_addrs.git
synced 2026-02-27 09:54:15 +08:00
Reduce the access frequency of the Amap API.
This commit is contained in:
+1
-1
@@ -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
@@ -1,4 +1,4 @@
|
||||
Requests==2.31.0
|
||||
SQLAlchemy==2.0.24
|
||||
psycopg2-binary==2.9.9
|
||||
Requests
|
||||
SQLAlchemy
|
||||
psycopg2-binary
|
||||
pysocks
|
||||
|
||||
@@ -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':
|
||||
|
||||
Reference in New Issue
Block a user