m8chaa commited on
Commit
bcb46aa
·
verified ·
1 Parent(s): 4e3faad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -895,6 +895,17 @@ async def sync_data(data_json: str = Form(...), user_id: str = Form(...)):
895
 
896
 
897
 
 
 
 
 
 
 
 
 
 
 
 
898
 
899
 
900
  # Function to watch a Google Drive folder
@@ -910,7 +921,8 @@ def create_channel(service, folder_id):
910
  @app.post("/watch/{folder_id}")
911
  async def watch_folder_endpoint(folder_id: str):
912
  try:
913
-
 
914
  # Create a channel to watch the folder
915
  response = create_channel(drive_service, folder_id)
916
 
 
895
 
896
 
897
 
898
+ def get_file(service, file_id):
899
+ try:
900
+ file = service.files().get(fileId=file_id).execute()
901
+ print('Found file: %s (%s)' % (file.get('name'), file.get('id')))
902
+ return file
903
+ except Exception as e:
904
+ print('An error occurred:', e)
905
+ return None
906
+ def get_user_info(service):
907
+ about = service.about().get(fields='user').execute()
908
+ print('User info:', about['user'])
909
 
910
 
911
  # Function to watch a Google Drive folder
 
921
  @app.post("/watch/{folder_id}")
922
  async def watch_folder_endpoint(folder_id: str):
923
  try:
924
+ get_user_info(drive_service)
925
+ get_file(drive_service, folder_id)
926
  # Create a channel to watch the folder
927
  response = create_channel(drive_service, folder_id)
928