leandroaraujodev commited on
Commit
a4ffc6c
·
verified ·
1 Parent(s): 04ed5ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -178,15 +178,20 @@ from llama_index.readers.google import GoogleDriveReader
178
  import json
179
 
180
  credentials_json = os.getenv('GOOGLE_CREDENTIALS')
 
181
 
182
  if credentials_json is None:
183
  raise ValueError("The GOOGLE_CREDENTIALS environment variable is not set.")
184
 
185
  # Write the credentials to a file
186
  credentials_path = "credentials.json"
 
187
  with open(credentials_path, 'w') as credentials_file:
188
  credentials_file.write(credentials_json)
189
 
 
 
 
190
  google_drive_reader = GoogleDriveReader(credentials_path=credentials_path)
191
  google_drive_reader._creds = google_drive_reader._get_credentials()
192
 
 
178
  import json
179
 
180
  credentials_json = os.getenv('GOOGLE_CREDENTIALS')
181
+ token_json = os.getenv('GOOGLE_TOKEN')
182
 
183
  if credentials_json is None:
184
  raise ValueError("The GOOGLE_CREDENTIALS environment variable is not set.")
185
 
186
  # Write the credentials to a file
187
  credentials_path = "credentials.json"
188
+ token_path = "token.json"
189
  with open(credentials_path, 'w') as credentials_file:
190
  credentials_file.write(credentials_json)
191
 
192
+ with open(token_path, 'w') as credentials_file:
193
+ credentials_file.write(token_json)
194
+
195
  google_drive_reader = GoogleDriveReader(credentials_path=credentials_path)
196
  google_drive_reader._creds = google_drive_reader._get_credentials()
197