Spaces:
Sleeping
Sleeping
Commit ยท
b38efc3
1
Parent(s): 24e2309
no message
Browse files- app/app.py +2 -2
app/app.py
CHANGED
|
@@ -11,7 +11,7 @@ import json
|
|
| 11 |
import pytz
|
| 12 |
from google.oauth2 import service_account
|
| 13 |
from googleapiclient.discovery import build
|
| 14 |
-
from google.auth.transport.requests import Request
|
| 15 |
from google.oauth2.credentials import Credentials
|
| 16 |
from google_auth_oauthlib.flow import InstalledAppFlow
|
| 17 |
import google.generativeai as genai
|
|
@@ -84,7 +84,7 @@ def get_credentials():
|
|
| 84 |
# ํฌ๋ฆฌ๋ด์
์ด ์๊ฑฐ๋ ์ ํจํ์ง ์์ผ๋ฉด ์ฌ์ฉ์ ๋ก๊ทธ์ธ ํ๋ก์ฐ๋ฅผ ์คํํฉ๋๋ค.
|
| 85 |
if not creds or not creds.valid:
|
| 86 |
if creds and creds.expired and creds.refresh_token:
|
| 87 |
-
creds.refresh(
|
| 88 |
else:
|
| 89 |
flow = InstalledAppFlow.from_client_secrets_file(
|
| 90 |
CREDENTIALS_FILENAME, SCOPES)
|
|
|
|
| 11 |
import pytz
|
| 12 |
from google.oauth2 import service_account
|
| 13 |
from googleapiclient.discovery import build
|
| 14 |
+
from google.auth.transport.requests import Request as GoogleRequest
|
| 15 |
from google.oauth2.credentials import Credentials
|
| 16 |
from google_auth_oauthlib.flow import InstalledAppFlow
|
| 17 |
import google.generativeai as genai
|
|
|
|
| 84 |
# ํฌ๋ฆฌ๋ด์
์ด ์๊ฑฐ๋ ์ ํจํ์ง ์์ผ๋ฉด ์ฌ์ฉ์ ๋ก๊ทธ์ธ ํ๋ก์ฐ๋ฅผ ์คํํฉ๋๋ค.
|
| 85 |
if not creds or not creds.valid:
|
| 86 |
if creds and creds.expired and creds.refresh_token:
|
| 87 |
+
creds.refresh(GoogleRequest())
|
| 88 |
else:
|
| 89 |
flow = InstalledAppFlow.from_client_secrets_file(
|
| 90 |
CREDENTIALS_FILENAME, SCOPES)
|