使用Google API Python客户库库的BOUND方法http请求http请求

发布于 2025-02-05 04:37:58 字数 591 浏览 1 评论 0原文

我正在使用Python,以便使用Google API客户端Python库向YouTube数据API提出请求。我没有任何错误,但是每当我尝试打印出响应结果时,这种响应都会不断弹出:

<bound method HttpRequest.execute of <googleapiclient.http.HttpRequest object at 0x10af09ca0>>

这是我使用的代码:


from googleapiclient.discovery import build

api_key = '<my_api_key_redacted>'

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

request = youtube.channels().list(part='statistics',forUsername='<my_user_id_redacted>')

response = request.execute

print(response)

如何解决此问题,以便我可以得到JSON结果而不是这个问题?

I am using Python in order to make a request to the Youtube Data API using the Google API Client Python Library. I don't get any errors, but this same response keeps popping up anytime I try to print out my response results:

<bound method HttpRequest.execute of <googleapiclient.http.HttpRequest object at 0x10af09ca0>>

This is the code I am using:


from googleapiclient.discovery import build

api_key = '<my_api_key_redacted>'

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

request = youtube.channels().list(part='statistics',forUsername='<my_user_id_redacted>')

response = request.execute

print(response)

How do I fix this issue so I can get json results and not this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

仅此而已 2025-02-12 04:37:59

我犯了同样的错误,这是.execute(),您缺少第二行的括号。

I made the same mistake, it's .execute(), you're missing the parentheses in the second to last line.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文