如何读取Google People API响应对象[已更新]

发布于 2025-02-05 14:11:55 字数 516 浏览 2 评论 0 原文

我是Google API的新手,并且很难阅读人们联系的内容。

为了获取特定联系人的详细信息,参考文献显示该代码应该有效[编辑:我更新了Personfields]:

  profile = service.people().get(resourceName='people/c63810788897573286', personFields='names')

ResourceName是特定联系人的ID(该ID仅适用于可以访问我的帐户的人)。该服务器正确抓住它并返回以下

如何阅读此对象的内容?我无法从

我想打印出名称。我是API的新手,所以也许有一种读取HTTP对象的标准方法,或者也许是Google API所独有的。感谢您的建议

I'm new to Google's API and I'm having trouble reading the content of a People contact.

To get the details of a particular contact, references show this code should work [Edit: I updated the personfields]:

  profile = service.people().get(resourceName='people/c63810788897573286', personFields='names')

The resourceName is the ID of a particular contact (that ID will only work for someone with access to my account). The server grabs it correctly and returns this:

<googleapiclient.discovery.Resource object at 0x10fd183c8>

How do I read the content of this object? I can't figure out from the documentation

I want to print out the Name. I'm pretty new to APIs, so maybe there is a standard way to read an HTTP object or maybe it's something unique to Google's API. Thanks for any advice

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

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

发布评论

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

评论(1

木森分化 2025-02-12 14:11:55

我在另一个有点<<< /a>相关的stackoverflow。我需要在调用中添加.execute()

profile = service.people().get(resourceName='people/c63810788897573286', personFields='names').execute()

I found an answer in another somewhat related StackOverflow. I needed to the add .execute() to the call

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