0

I have a question regarding contact creation using the python Google data API. I am trying the example for contact creation with python, exactly like it is in the documentation page (https://developers.google.com/google-apps/contacts/v3/#creating_contacts)

So, i created the client as following:

email='<my gmail uid>'
password='<my gmail pwd>'
gd_client = gdata.contacts.client.ContactsClient(source='GoogleInc-ContactsPythonSample-1')
try:
    gd_client.ClientLogin(email, password, gd_client.source)
except gdata.client.BadAuthentication:
    print 'Invalid user credentials given.'
    gd_client = None

Then i executed the function using:

create_contact(gd_client)

What i get from this call is:

Traceback (most recent call last):
  File "<ipython console>", line 1, in <module>
  File "<ipython console>", line 23, in create_contact
AttributeError: 'module' object has no attribute 'PostCode'

So I want to ask whether i am doing something wrong, whether this is a known bug, or whether the documentation is simply outdated. Thanks.

p.s. a small comment, i think a better wrapping of the Google data API in the python library could be useful. I spent significant time in finding, within the API implementation, what fields should be set (directly!) and what classes should be used to assign them.

4

1 回答 1

0

好的,看来我可以回答我的问题,这部分是重复的

如何创建谷歌联系人?

事实证明,文档中的示例代码无效(thanks, Google) PostCode 应该是 Postcode,即时通讯地址也不正确。

删除它,它成功完成

于 2013-04-18T13:36:11.187 回答