From 1c831baede6d94428c62af37cdb9aa35c209c171 Mon Sep 17 00:00:00 2001 From: lexara-prime-ai Date: Mon, 8 Jul 2024 11:21:45 +0000 Subject: [PATCH] Updated error handling, updated poetry config --- hyper/hyper/constants.py | 2 +- hyper/hyper/server.py | 30 ++++++++++++++++++------------ hyper/pyproject.toml | 1 - 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/hyper/hyper/constants.py b/hyper/hyper/constants.py index b63f89f..308b358 100644 --- a/hyper/hyper/constants.py +++ b/hyper/hyper/constants.py @@ -3,4 +3,4 @@ FULL_PATH = FILE_PATH + "/" + FILE_NAME SCOPES = ["https://www.googleapis.com/auth/drive"] SERVICE_ACCOUNT_FILE = "service_account.json" -PARENT_FOLDER_ID = "1uVnscmoxu91XT1LMnZoOOn3iCTirlEII" +PARENT_FOLDER_ID = "1uVnscmoxu91XT1LMnZoOOn3iCTirlEII" \ No newline at end of file diff --git a/hyper/hyper/server.py b/hyper/hyper/server.py index 9b7676a..3ea707a 100644 --- a/hyper/hyper/server.py +++ b/hyper/hyper/server.py @@ -3,10 +3,10 @@ import csv import os +# Utility modules. import constants import drive import error_handling - import python_wrapper.python_wrapper @@ -169,17 +169,23 @@ async def __call__(self): def parse_args(): - parser = argparse.ArgumentParser(description="WSPR Spot Data Server") - - # Receive the [interval] from the user. - parser.add_argument( - "--interval", type=int, default=900, help="Sleep interval in seconds" - ) - # Receive the [num_rows] from the user. - parser.add_argument( - "--num_rows", type=str, default="10", help="Number of rows to return" - ) - return parser.parse_args() + try: + parser = argparse.ArgumentParser(description="WSPR Spot Data Server") + + # Receive the [interval] from the user. + parser.add_argument( + "--interval", type=int, default=900, help="Sleep interval in seconds" + ) + # Receive the [num_rows] from the user. + parser.add_argument( + "--num_rows", type=str, default="10", help="Number of rows to return" + ) + return parser.parse_args() + except Exception as e: + self.error_handling.propagate_error( + f"{parse_args.__name__}", + f"Failed to parse arguments: {e}" + ) if __name__ == "__main__": diff --git a/hyper/pyproject.toml b/hyper/pyproject.toml index 78d2dae..964633a 100644 --- a/hyper/pyproject.toml +++ b/hyper/pyproject.toml @@ -7,7 +7,6 @@ readme = "README.md" [tool.poetry.dependencies] python = "^3.11" -fastapi = "*" [build-system]