diff --git a/setup.py b/setup.py index 769933e..ea45dec 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ ] setup( - name="sayvai_tools", + name="sayvai-tools", version="0.0.1", description="Tools for the assistant", author="sayvai-io", diff --git a/src/sayvai_tools/utils/google/gcalendar.py b/src/sayvai_tools/utils/google/gcalendar.py index 8f25857..50a8a16 100644 --- a/src/sayvai_tools/utils/google/gcalendar.py +++ b/src/sayvai_tools/utils/google/gcalendar.py @@ -25,8 +25,10 @@ def __init__(self, scope: str, summary=None, email=None) -> None: self.calendar_id = "primary" self.organizer_email = email self.summary = summary - if os.path.exists("token.json"): - self.creds = Credentials.from_authorized_user_file("token.json", self.SCOPE) + self.token_path = os.environ["GTOKEN_PATH"] + self.credential_path = os.environ["GOOGLE_CREDENTIALS_PATH"] + if os.path.exists(self.token_path): + self.creds = Credentials.from_authorized_user_file(self.token_path, self.SCOPE) else: self.get_credentials() # if self.creds and self.creds.expired and self.creds.refresh_token: @@ -35,10 +37,10 @@ def __init__(self, scope: str, summary=None, email=None) -> None: def get_credentials(self): """Gets the credentials for the user""" - flow = InstalledAppFlow.from_client_secrets_file("credentials.json", self.SCOPE) + flow = InstalledAppFlow.from_client_secrets_file(self.credential_path, self.SCOPE) self.creds = flow.run_local_server(port=0) - with open("token.json", "w") as token: + with open(self.token_path, "w") as token: token.write(self.creds.to_json()) return "Credentials obtained" diff --git a/src/sayvai_tools/utils/google/sheets.py b/src/sayvai_tools/utils/google/sheets.py index 1ad20dc..4a6af54 100644 --- a/src/sayvai_tools/utils/google/sheets.py +++ b/src/sayvai_tools/utils/google/sheets.py @@ -3,6 +3,7 @@ import gspread import datetime from gspread import utils +import os class GSheets: @@ -10,10 +11,10 @@ class GSheets: def __init__(self) -> None: self.gc, _user = self.authenticate() - pass + self.credential_path = os.environ["GOOGLE_CREDENTIALS_PATH"] def get_credentials(self): - with open("credentials.json") as f: + with open(self.credential_path) as f: data = json.load(f) return data diff --git a/src/sayvai_tools/utils/microsoft/word.py b/src/sayvai_tools/utils/microsoft/word.py new file mode 100644 index 0000000..b847b55 --- /dev/null +++ b/src/sayvai_tools/utils/microsoft/word.py @@ -0,0 +1,5 @@ +#creating word + + +class Word: + raise NotImplementedError \ No newline at end of file