refactored

This commit is contained in:
2025-03-30 13:10:48 +02:00
parent 7eb0ab96ef
commit 8eaafb6bda
6 changed files with 109 additions and 100 deletions
+4 -4
View File
@@ -23,7 +23,6 @@ domains = [
"measurements"
]
class WeCollector:
def __init__(self, user):
# Init collecting records
@@ -92,7 +91,6 @@ class WeCollector:
except Exception as e:
print(f"Exception: {e}")
def request_loop(wc: WeCollector):
_date_last = None
_file_timestamp = None
@@ -122,8 +120,7 @@ def request_loop(wc: WeCollector):
time_to_wait = 0
time.sleep(time_to_wait)
if __name__ == '__main__':
def main() -> None:
parser = argparse.ArgumentParser(prog="We Collect", description="Collects vehicle data")
parser.add_argument("username", help="Username to collect data for (must exist in credentials.py)")
parser.add_argument("--loop", help="Execute once or create event loop", type=bool, default=False)
@@ -142,3 +139,6 @@ if __name__ == '__main__':
print(f"Terminated with Exception {e}")
print(f"Terminated Normally")
if __name__ == '__main__':
main()