creds-fix
All checks were successful
Deploy to core / deploy (push) Successful in 1m59s

This commit is contained in:
Untone 2024-01-28 16:38:17 +03:00
parent 7f203bf900
commit 4bd7e7d0a1

View File

@ -43,9 +43,8 @@ class ViewedStorage:
"""Подключение к клиенту Google Analytics с использованием аутентификации"""
self = ViewedStorage
async with self.lock:
creds = open(GOOGLE_KEYFILE_PATH).read()
os.environ.setdefault('GOOGLE_APPLICATION_CREDENTIALS', creds)
if creds and GOOGLE_PROPERTY_ID:
os.environ.setdefault('GOOGLE_APPLICATION_CREDENTIALS', GOOGLE_KEYFILE_PATH)
if GOOGLE_KEYFILE_PATH:
# Using a default constructor instructs the client to use the credentials
# specified in GOOGLE_APPLICATION_CREDENTIALS environment variable.
self.analytics_client = BetaAnalyticsDataClient()