File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
zulip/integrations/google Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env python3
2+ import logging
23import os
4+ import sys
35
46from google .auth .transport .requests import Request
57from google .oauth2 .credentials import Credentials
@@ -40,9 +42,14 @@ def get_credentials() -> Credentials:
4042 if creds and creds .expired and creds .refresh_token :
4143 creds .refresh (Request ())
4244 else :
43- flow = InstalledAppFlow .from_client_secrets_file (
44- os .path .join (HOME_DIR , CLIENT_SECRET_FILE ), SCOPES
45- )
45+ client_secret_path = os .path .join (HOME_DIR , CLIENT_SECRET_FILE )
46+ if not os .path .exists (client_secret_path ):
47+ logging .error (
48+ "Unable to find the client secret file. Please ensure that you have downloaded the client secret file from Google, and placed it at %s." ,
49+ client_secret_path ,
50+ )
51+ sys .exit (1 )
52+ flow = InstalledAppFlow .from_client_secrets_file (client_secret_path , SCOPES )
4653 creds = flow .run_local_server (port = 0 )
4754 with open (tokens_path , "w" ) as token :
4855 token .write (creds .to_json ())
You can’t perform that action at this time.
0 commit comments