diff --git a/bot_util/__init__.py b/bot_util/__init__.py index bc03fa6..f18396f 100644 --- a/bot_util/__init__.py +++ b/bot_util/__init__.py @@ -1,2 +1,3 @@ +from .crendential import get_api_details from .file_util import write_file, write_file_batch -__all__ = ['write_file', 'write_file_batch'] \ No newline at end of file +__all__ = ['write_file', 'write_file_batch','get_api_details'] \ No newline at end of file diff --git a/bot_util/crendential.py b/bot_util/crendential.py new file mode 100644 index 0000000..6a3c9d8 --- /dev/null +++ b/bot_util/crendential.py @@ -0,0 +1,24 @@ +from dotenv import load_dotenv +import os + +load_dotenv() + +API_KEY = os.getenv("DEEPSEEK_API_KEY") +API_URL = os.getenv("DEEPSEEK_API_URL") + +class ApiCredential: + def __init__(self, api_key: str, api_url: str): + self.api_key = api_key + self.api_url = api_url + + def get_api_key(self): + return self.api_key + + def get_api_url(self): + return self.api_url + +def get_api_details() -> ApiCredential: + """ + Get the API key and URL from environment variables. + """ + return ApiCredential(API_KEY, API_URL) \ No newline at end of file