【问题标题】:Can I convert a Google Contacts API XML response to a Gdata feed object?我可以将 Google 联系人 API XML 响应转换为 Gdata 提要对象吗?
【发布时间】:2014-09-03 05:06:05
【问题描述】:

我正在使用带有 Oauth2 的应用引擎来获取所有联系人

https://developers.google.com/api-client-library/python/guide/google_app_engine

    if decorator.has_credentials():
    http = decorator.http()
    resp, content = http.request(decorator._scope,method="GET")

在这里,我得到所有联系人的 xml 响应...https://developers.google.com/google-apps/contacts/v3/#retrieving_all_contacts

在 Google Contacts API V3 文档 (https://developers.google.com/google-apps/contacts/v3/) 中,它展示了如何使用 Gdata 将数据作为提要对象进行操作。

我的问题是,如何将我的 resp 转换为提要对象?在我自己开始解析 XML 之前,我想知道这是否可行。

【问题讨论】:

    标签: google-app-engine python-2.7 google-api-python-client


    【解决方案1】:

    您应该使用GData API client library for Python,它将为您处理所有这些。

    【讨论】:

    • 我会考虑使用这个;我从应用引擎特定的库开始,因为它本身很容易获得响应。
    • Gdata 库旨在在 App Engine 之上运行。
    • 我决定更改范围以使用更容易使用的 JSON 响应,例如google.com/m8/feeds/contacts/default/full?alt=json
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-18
    • 1970-01-01
    • 2011-01-29
    相关资源
    最近更新 更多