替换 localhost 为 127.0.0.1,避免 DNS 解析影响响应速度

This commit is contained in:
JIANG
2025-12-02 10:48:53 +08:00
parent 33c467fe39
commit 523fee275f
7 changed files with 12 additions and 25 deletions

View File

@@ -46,7 +46,7 @@ def queryallrecordsbydate_by_url(querydate: str):
try:
response = urllib.request.urlopen(
f"http://localhost/queryallrecordsbydate/?querydate={querydate}"
f"http://127.0.0.1/queryallrecordsbydate/?querydate={querydate}"
)
html = response.read().decode("utf-8")
@@ -66,7 +66,7 @@ def queryallscadarecordsbydate_by_url(querydate: str):
try:
response = urllib.request.urlopen(
f"http://localhost/queryallscadarecordsbydate/?querydate={querydate}"
f"http://127.0.0.1/queryallscadarecordsbydate/?querydate={querydate}"
)
html = response.read().decode("utf-8")
@@ -77,7 +77,7 @@ def queryallscadarecordsbydate_by_url(querydate: str):
def auto_cache_data():
# 初始化 Redis 连接
# 用redis 限制并发访u
redis_client = redis.Redis(host="localhost", port=6379, db=0)
redis_client = redis.Redis(host="127.0.0.1", port=6379, db=0)
# auto cache data for the last 3 days
today = datetime.date.today()