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 1
1
#!/usr/bin/env python3
2
+ import logging
2
3
import os
4
+ import sys
3
5
4
6
from google .auth .transport .requests import Request
5
7
from google .oauth2 .credentials import Credentials
@@ -40,9 +42,14 @@ def get_credentials() -> Credentials:
40
42
if creds and creds .expired and creds .refresh_token :
41
43
creds .refresh (Request ())
42
44
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 )
46
53
creds = flow .run_local_server (port = 0 )
47
54
with open (tokens_path , "w" ) as token :
48
55
token .write (creds .to_json ())
You can’t perform that action at this time.
0 commit comments