Refine
This commit is contained in:
@@ -5,7 +5,7 @@ import shutil
|
|||||||
import redis
|
import redis
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
def query_all_records_by_date_with_type_flow(date: str):
|
def query_all_records_by_date_with_type_link(date: str):
|
||||||
try:
|
try:
|
||||||
response = urllib.request.urlopen(f'http://localhost/queryallrecordsbydatewithtype/?querydate={date}&querytype=flow')
|
response = urllib.request.urlopen(f'http://localhost/queryallrecordsbydatewithtype/?querydate={date}&querytype=flow')
|
||||||
html = response.read().decode('utf-8')
|
html = response.read().decode('utf-8')
|
||||||
@@ -17,7 +17,7 @@ def auto_cache_data():
|
|||||||
|
|
||||||
redis_client = redis.Redis(host='localhost', port=6379, db=0)
|
redis_client = redis.Redis(host='localhost', port=6379, db=0)
|
||||||
|
|
||||||
items = ['queryallrecordsbydatewithtype_[DATE]_flow']
|
items = ['queryallrecordsbydatewithtype_[DATE]_link']
|
||||||
|
|
||||||
today = datetime.date.today()
|
today = datetime.date.today()
|
||||||
print(today)
|
print(today)
|
||||||
@@ -28,7 +28,7 @@ def auto_cache_data():
|
|||||||
key = item.replace('[DATE]', str_prev_day)
|
key = item.replace('[DATE]', str_prev_day)
|
||||||
|
|
||||||
if not redis_client.exists(key):
|
if not redis_client.exists(key):
|
||||||
query_all_records_by_date_with_type_flow(str_prev_day)
|
query_all_records_by_date_with_type_link(str_prev_day)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
auto_cache_data()
|
auto_cache_data()
|
||||||
|
|||||||
Reference in New Issue
Block a user