curiousgeorge1292 commited on
Commit
cee38d2
·
verified ·
1 Parent(s): 01e805b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -12,13 +12,14 @@ client = Groq(api_key=os.environ.get("GROQ_API_KEY"))
12
 
13
  # Google Sheets setup
14
  SCOPES = ['https://www.googleapis.com/auth/spreadsheets']
15
- SERVICE_ACCOUNT_FILE = os.environ.get("MY_SERVICE_ACCOUNT_JSON")
16
  SPREADSHEET_ID = os.environ.get("GOOGLE_SHEET_ID")
17
 
18
- service_account_info = json.loads(MY_SERVICE_ACCOUNT_JSON)
19
- credentials = Credentials.from_service_account_info(
20
- service_account_info, scopes=SCOPES
21
- )
 
22
  service = build('sheets', 'v4', credentials=credentials)
23
  sheet = service.spreadsheets()
24
 
 
12
 
13
  # Google Sheets setup
14
  SCOPES = ['https://www.googleapis.com/auth/spreadsheets']
15
+ SERVICE_ACCOUNT_JSON = os.environ.get("MY_SERVICE_ACCOUNT_JSON")
16
  SPREADSHEET_ID = os.environ.get("GOOGLE_SHEET_ID")
17
 
18
+ if not SERVICE_ACCOUNT_JSON:
19
+ raise ValueError("MY_SERVICE_ACCOUNT_JSON environment variable is not set or empty.")
20
+
21
+ service_account_info = json.loads(SERVICE_ACCOUNT_JSON)
22
+ credentials = Credentials.from_service_account_info(service_account_info, scopes=SCOPES)
23
  service = build('sheets', 'v4', credentials=credentials)
24
  sheet = service.spreadsheets()
25