geekaijosh commited on
Commit
b062d8f
·
verified ·
1 Parent(s): 7ca5907

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -14
app.py CHANGED
@@ -20,20 +20,9 @@ from googleapiclient.discovery import build
20
  # ==== Google Calendar Setup ====
21
  SCOPES = ['https://www.googleapis.com/auth/calendar.events']
22
  def get_calendar_service():
23
- creds = None
24
- if os.path.exists('token.json'):
25
- creds = Credentials.from_authorized_user_file('token.json', SCOPES)
26
- if not creds or not creds.valid:
27
- if creds and creds.expired and creds.refresh_token:
28
- from google.auth.transport.requests import Request
29
- creds.refresh(Request())
30
- else:
31
- flow = InstalledAppFlow.from_client_secrets_file('credentials.json', SCOPES)
32
- creds = flow.run_local_server(port=0)
33
- with open('token.json', 'w') as token:
34
- token.write(creds.to_json())
35
- print("✅ token.json saved.")
36
- return build('calendar', 'v3', credentials=creds)
37
  # === Pushover Function ===
38
  def send_notification(message):
39
  try:
 
20
  # ==== Google Calendar Setup ====
21
  SCOPES = ['https://www.googleapis.com/auth/calendar.events']
22
  def get_calendar_service():
23
+ creds = Credentials.from_authorized_user_file("token.json", SCOPES)
24
+ return build("calendar", "v3", credentials=creds)
25
+
 
 
 
 
 
 
 
 
 
 
 
26
  # === Pushover Function ===
27
  def send_notification(message):
28
  try: