Skip to content

Commit d5bfb79

Browse files
committed
#516 changed the secret load to json file way
#516 changed the secret load to json file way
1 parent bfb47f3 commit d5bfb79

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/penn_chime/presentation.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,9 +433,15 @@ def subscribe(st_obj):
433433
affiliation = st_obj.text_input (label="Enter Affiliation", value="", key="na_upper_2")
434434
if st_obj.button (label="Submit", key="ta_submit_1"):
435435
row = [email, name, affiliation]
436-
send_subscription_to_google_sheet(st_obj, row)
436+
send_subscription_to_google_sheet_secret_json(st_obj, row)
437437

438-
def send_subscription_to_google_sheet(st_obj, row):
438+
def send_subscription_to_google_sheet_secret_json(st_obj, row):
439+
json_secret = "/Users/mpatil763/opensource/COVED-19/repo/chime/src/penn_chime/client_secret.json"
440+
#print(json_secret)
441+
spr = sp.spreadsheet (st_obj, json_secret)
442+
spr.writeToSheet("CHIME Form Submissions", row)
443+
444+
def send_subscription_to_google_sheet_secret_dict(st_obj, row):
439445
json_secret = readGoogleApiSecretsDict()
440446
#print(json_secret)
441447
spr = sp.spreadsheet (st_obj, json_secret)

src/penn_chime/spreadsheet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ def __init__(self, st_obj, secret):
77
# use creds to create a client to interact with the Google Drive API
88
self.scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
99
#secret = 'client_secret.json'
10-
self.creds = ServiceAccountCredentials.from_json(secret)
11-
#self.creds = ServiceAccountCredentials.from_json_keyfile_name(secret, self.scope)
10+
#self.creds = ServiceAccountCredentials.from_json_keyfile_dict(secret)
11+
self.creds = ServiceAccountCredentials.from_json_keyfile_name(secret, self.scope)
1212
self.client = gspread.authorize(self.creds)
1313

1414

0 commit comments

Comments
 (0)