mbecchis commited on
Commit
774d553
·
verified ·
1 Parent(s): 5b1bbdf

Update app1.py

Browse files
Files changed (1) hide show
  1. app1.py +4 -3
app1.py CHANGED
@@ -28,18 +28,19 @@ st.markdown(
28
  unsafe_allow_html=True
29
  )
30
 
 
31
  def get_creds():
32
  raw = os.getenv("GCP_SERVICE_ACCOUNT")
 
33
  if raw is None:
34
  raise ValueError("Missing GCP_CREDENTIALS environment variable.")
35
- return Credentials.from_service_account_info(json.loads(raw), scopes=SCOPES)
36
 
37
 
38
  # Google Sheets connection
39
  @st.cache_data(ttl=300) # Cache for 5 minutes (same as refresh interval)
40
  def load_data():
41
- scopes = ['https://www.googleapis.com/auth/spreadsheets.readonly']
42
- creds = get_creds()
43
  client = gspread.authorize(creds)
44
 
45
  sheet_id = '1J4YQEf8WvdlS3BjIOya0jsrPHolBEVodSAmhYF9XtSk'
 
28
  unsafe_allow_html=True
29
  )
30
 
31
+
32
  def get_creds():
33
  raw = os.getenv("GCP_SERVICE_ACCOUNT")
34
+ scopes = ['https://www.googleapis.com/auth/spreadsheets.readonly']
35
  if raw is None:
36
  raise ValueError("Missing GCP_CREDENTIALS environment variable.")
37
+ return Credentials.from_service_account_info(json.loads(raw), scopes=scopes)
38
 
39
 
40
  # Google Sheets connection
41
  @st.cache_data(ttl=300) # Cache for 5 minutes (same as refresh interval)
42
  def load_data():
43
+ creds, scopes = get_creds()
 
44
  client = gspread.authorize(creds)
45
 
46
  sheet_id = '1J4YQEf8WvdlS3BjIOya0jsrPHolBEVodSAmhYF9XtSk'