From ea09d716046d619a4b39cbe32387c2b606044045 Mon Sep 17 00:00:00 2001 From: DingZQ Date: Sat, 22 Mar 2025 12:49:41 +0800 Subject: [PATCH] Refine --- auto_cache.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/auto_cache.py b/auto_cache.py index 4c6e228..ebeab5b 100644 --- a/auto_cache.py +++ b/auto_cache.py @@ -25,13 +25,18 @@ def queryallrecordsbydateproperty(date: str): print(f'queryallrecordsbydateproperty: {date}') try: - response = urllib.request.urlopen(f'http://localhost/queryallrecordsbydateproperty/?querydate={date}&querytype=node&property=head') - html = response.read().decode('utf-8') - #print(html) - response = urllib.request.urlopen(f'http://localhost/queryallrecordsbydateproperty/?querydate={date}&querytype=link&property=flow') - html = response.read().decode('utf-8') - #print(html) + node_properties = ['head', 'pressure', 'actualdemand', 'quality'] + for property in node_properties: + response = urllib.request.urlopen(f'http://localhost/queryallrecordsbydateproperty/?querydate={date}&querytype=node&property={property}') + html = response.read().decode('utf-8') + #print(html) + + link_properties = ['flow', 'velocity', 'headloss', 'quality'] + for property in link_properties: + response = urllib.request.urlopen(f'http://localhost/queryallrecordsbydateproperty/?querydate={date}&querytype=link&property={property}') + html = response.read().decode('utf-8') + #print(html) except urllib.error.URLError as e: print("Error")