Skip to content

Commit 354312a

Browse files
[youtube-data-api] feat: use GARF_YOUTUBE_DATA_API_KEY
1 parent f6d38bb commit 354312a

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

libs/garf_community/google/youtube/youtube-data-api/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
* [YouTube Data API](https://console.cloud.google.com/apis/library/youtube.googleapis.com) enabled.
1111
* [API key](https://support.google.com/googleapi/answer/6158862?hl=en) to access to access YouTube Data API.
12-
> Once generated expose API key as `export GOOGLE_API_KEY=<YOUR_API_KEY>`
12+
> Once generated expose API key as `export GARF_YOUTUBE_DATA_API_KEY=<YOUR_API_KEY>`
1313
1414
## Installation
1515

libs/garf_community/google/youtube/youtube-data-api/garf_youtube_data_api/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
'YouTubeDataApiReportFetcher',
2525
]
2626

27-
__version__ = '0.0.8'
27+
__version__ = '0.0.9'

libs/garf_community/google/youtube/youtube-data-api/garf_youtube_data_api/api_clients.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"""Creates API client for YouTube Data API."""
1515

1616
import os
17+
import warnings
1718

1819
from googleapiclient.discovery import build
1920
from typing_extensions import override
@@ -31,15 +32,21 @@ class YouTubeDataApiClient(api_clients.BaseClient):
3132

3233
def __init__(
3334
self,
34-
api_key: str = os.getenv('GOOGLE_API_KEY'),
35+
api_key: str = os.getenv('GARF_YOUTUBE_DATA_API_KEY'),
3536
api_version: str = 'v3',
3637
**kwargs: str,
3738
) -> None:
3839
"""Initializes YouTubeDataApiClient."""
40+
if not api_key and os.getenv('GOOGLE_API_KEY'):
41+
warnings.DeprecatingWarning(
42+
'You are using deprecated GOOGLE_API_KEY variable to create '
43+
'YouTubeDataApiClient. Use GARF_YOUTUBE_DATA_API_KEY variable instead'
44+
)
45+
api_key = os.getenv('GOOGLE_API_KEY')
3946
if not api_key:
4047
raise YouTubeDataApiClientError(
4148
'api_key is not found. Either pass to YouTubeDataApiClient as api_key '
42-
'parameter or expose as GOOGLE_API_KEY ENV varible'
49+
'parameter or expose as GARF_YOUTUBE_DATA_API_KEY ENV variable'
4350
)
4451
self.api_key = api_key
4552
self.api_version = api_version

0 commit comments

Comments
 (0)