Вопрос

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.

Это было полезно?

Решение

Ok, it seems that i can answer my question, which is partly a duplicate of

how to create google contact?

It turns out that the sample code in the documentation is invalid (thanks, Google) PostCode should be Postcode, and the instant messaging address is also incorrect.

Removing that, it completes successfully

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top