创建新的联系人Google API

时间:2017-10-26 07:34:09

标签: python google-people google-python-api

我按照指南: https://developers.google.com/people/v1/write-people

我的代码:

"@angular/material": {
  "version": "2.0.0-beta.12",
  "resolved": "https://registry.npmjs.org/@angular/material/-/material-2.0.0-beta.12.tgz",
  "integrity": "sha1-cbbQt7AhiR5dDjaIwdS9eMdFf1g=",
  "requires": {
    "tslib": "1.8.0"
  }
},

当我跑步时,我的错误:

def main():
    """Shows basic usage of the Google People API
    """
    credentials = get_credentials()
    http = credentials.authorize(httplib2.Http())
    service = discovery.build('people', 'v1', http=http,
        discoveryServiceUrl='https://people.googleapis.com/$discovery/rest')

    contact2 = service.people().createContact(
        body={"names": [{"givenName": "John", "familyName": "Doe"}]}).execute()

    contact2()

if __name__ == '__main__':
    main()

我收到此错误。如何有效地创建新联系人?

2 个答案:

答案 0 :(得分:1)

你的问题是这一行: contact2() service.people().createContact将字典作为响应返回,您尝试调用它。

字典对象不是函数。

答案 1 :(得分:0)

问题解决了,虽然我不明白为什么。我能够使用以下方式保存联系:

STRING array((string)$row[0],(int)$row[1]);