hongaik commited on
Commit
4ed92c1
·
1 Parent(s): f77c653
Files changed (1) hide show
  1. app.py +15 -12
app.py CHANGED
@@ -315,23 +315,26 @@ with st.form("inputs"):
315
  # raise ValueError("Not a valid PEM post boundaryAAA")
316
  # st.write(m.group(1))
317
 
318
- # keydict = {'type': st.secrets["type"],
319
- # 'project_id': st.secrets["project_id"],
320
- # 'private_key_id': st.secrets["private_key_id"],
321
- # 'private_key': private_key,
322
- # 'client_email': st.secrets["client_email"],
323
- # 'client_id': st.secrets["client_id"],
324
- # 'auth_uri': st.secrets["auth_uri"],
325
- # 'token_uri': st.secrets["token_uri"],
326
- # 'auth_provider_x509_cert_url': st.secrets["auth_provider_x509_cert_url"],
327
- # 'client_x509_cert_url': st.secrets["client_x509_cert_url"]}
 
 
 
328
 
329
  scope = ['https://www.googleapis.com/auth/spreadsheets',
330
  "https://www.googleapis.com/auth/drive"]
331
 
332
  try:
333
- #credentials = ServiceAccountCredentials.from_json_keyfile_dict(keydict, scope)
334
- credentials = ServiceAccountCredentials.from_json_keyfile_name("updategsheet_keys.json", scope)
335
  client = gspread.authorize(credentials)
336
 
337
  sheet = client.open("PropertyPricePredictor_Sheet").sheet1
 
315
  # raise ValueError("Not a valid PEM post boundaryAAA")
316
  # st.write(m.group(1))
317
 
318
+ keydict = {'type': st.secrets["type"],
319
+ 'project_id': st.secrets["project_id"],
320
+ 'private_key_id': st.secrets["private_key_id"],
321
+ 'private_key': st.secrets["private_key"],
322
+ 'client_email': st.secrets["client_email"],
323
+ 'client_id': st.secrets["client_id"],
324
+ 'auth_uri': st.secrets["auth_uri"],
325
+ 'token_uri': st.secrets["token_uri"],
326
+ 'auth_provider_x509_cert_url': st.secrets["auth_provider_x509_cert_url"],
327
+ 'client_x509_cert_url': st.secrets["client_x509_cert_url"]}
328
+
329
+ r = json.dumps(keydict)
330
+ loaded_r = json.loads(r)
331
 
332
  scope = ['https://www.googleapis.com/auth/spreadsheets',
333
  "https://www.googleapis.com/auth/drive"]
334
 
335
  try:
336
+ credentials = ServiceAccountCredentials.from_json_keyfile_dict(loaded_r, scope)
337
+ #credentials = ServiceAccountCredentials.from_json_keyfile_name("updategsheet_keys.json", scope)
338
  client = gspread.authorize(credentials)
339
 
340
  sheet = client.open("PropertyPricePredictor_Sheet").sheet1