Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
srinick007 committed Nov 23, 2023
2 parents 105bb95 + 931993f commit e1f7338
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
]

setup(
name="sayvai_tools",
name="sayvai-tools",
version="0.0.1",
description="Tools for the assistant",
author="sayvai-io",
Expand Down
10 changes: 6 additions & 4 deletions src/sayvai_tools/utils/google/gcalendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"
Expand Down
5 changes: 3 additions & 2 deletions src/sayvai_tools/utils/google/sheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
import gspread
import datetime
from gspread import utils
import os


class GSheets:
"""Google Sheets API""" ""

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

Expand Down
5 changes: 5 additions & 0 deletions src/sayvai_tools/utils/microsoft/word.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#creating word


class Word:
raise NotImplementedError

0 comments on commit e1f7338

Please sign in to comment.