optimze code
This commit is contained in:
parent
bc6115442d
commit
12e733a9da
@ -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']
|
||||
__all__ = ['write_file', 'write_file_batch','get_api_details']
|
24
bot_util/crendential.py
Normal file
24
bot_util/crendential.py
Normal file
@ -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)
|
Loading…
x
Reference in New Issue
Block a user