api_key 未在 Jupyter notebook 中定义 (youtube API v3)

api_key not defined in Jupyter notebook (youtube API v3)

在第 1 行中,我定义了 api_key:

api_key = "api text text here"

在第 2 行中,我从 google-api-client-python

导入构建
from apiclient.discovery import build

在第 3 行中,我编写并执行了以下内容

youtube = build('youtube', 'v3', developerKey=api_key

然后按 Ctrl + Enter。然后我收到以下错误:

 NameError                                 Traceback (most recent call last)
<ipython-input-32-746108c79ca9> in <module>
----> 1 youtube = build('youtube,' 'v3', developerKey=api_key)

NameError: name 'api_key' is not defined

使用Shift+EnterCtrl+Enter 到 运行 API 键先