Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,9 @@ from google.oauth2.service_account import Credentials
|
|
6 |
import os
|
7 |
|
8 |
# Google Sheets setting
|
|
|
|
|
|
|
9 |
SHEET_ID = os.getenv('SHEET_ID') # Replace with your Google Sheet ID
|
10 |
log = 'cevauto'
|
11 |
password = os.getenv('PASSWORD')
|
@@ -13,11 +16,11 @@ USERS_SHEET = 'Users'
|
|
13 |
PURCHASE_ORDERS_SHEET = 'PurchaseOrders'
|
14 |
|
15 |
# Service account credentials file path
|
16 |
-
CREDENTIALS_FILE = 'credentials.json' # Replace with the path to your service account credentials file
|
17 |
|
18 |
# Initialize Google Sheets client
|
19 |
SCOPES = ['https://www.googleapis.com/auth/spreadsheets', 'https://www.googleapis.com/auth/drive']
|
20 |
-
creds = Credentials.
|
21 |
gc = gspread.authorize(creds)
|
22 |
sheet = gc.open_by_key(SHEET_ID)
|
23 |
|
|
|
6 |
import os
|
7 |
|
8 |
# Google Sheets setting
|
9 |
+
conf1 = os.getenv('CONF')
|
10 |
+
conf = json.dumps(conf1)
|
11 |
+
dict = json.loads(conf)
|
12 |
SHEET_ID = os.getenv('SHEET_ID') # Replace with your Google Sheet ID
|
13 |
log = 'cevauto'
|
14 |
password = os.getenv('PASSWORD')
|
|
|
16 |
PURCHASE_ORDERS_SHEET = 'PurchaseOrders'
|
17 |
|
18 |
# Service account credentials file path
|
19 |
+
# CREDENTIALS_FILE = 'credentials.json' # Replace with the path to your service account credentials file
|
20 |
|
21 |
# Initialize Google Sheets client
|
22 |
SCOPES = ['https://www.googleapis.com/auth/spreadsheets', 'https://www.googleapis.com/auth/drive']
|
23 |
+
creds = Credentials.from_service_account_info(dict, scopes=SCOPES)
|
24 |
gc = gspread.authorize(creds)
|
25 |
sheet = gc.open_by_key(SHEET_ID)
|
26 |
|