Spaces:
Sleeping
Sleeping
Update authenticate.py
Browse files- authenticate.py +4 -1
authenticate.py
CHANGED
|
@@ -1,11 +1,14 @@
|
|
| 1 |
from google.oauth2 import service_account
|
| 2 |
from google.auth.transport.requests import Request
|
|
|
|
| 3 |
import json
|
|
|
|
|
|
|
| 4 |
|
| 5 |
def get_access_token():
|
| 6 |
# Load service account credentials from JSON file or environment variable
|
| 7 |
credentials = service_account.Credentials.from_service_account_info(
|
| 8 |
-
json.loads('ACCOUNT_CREDS'),
|
| 9 |
scopes=['https://www.googleapis.com/auth/cloud-platform']
|
| 10 |
)
|
| 11 |
|
|
|
|
| 1 |
from google.oauth2 import service_account
|
| 2 |
from google.auth.transport.requests import Request
|
| 3 |
+
from dotenv import load_dotenv
|
| 4 |
import json
|
| 5 |
+
import os
|
| 6 |
+
load_dotenv()
|
| 7 |
|
| 8 |
def get_access_token():
|
| 9 |
# Load service account credentials from JSON file or environment variable
|
| 10 |
credentials = service_account.Credentials.from_service_account_info(
|
| 11 |
+
json.loads(os.getenv('ACCOUNT_CREDS')),
|
| 12 |
scopes=['https://www.googleapis.com/auth/cloud-platform']
|
| 13 |
)
|
| 14 |
|