django-developers is for the discussion of the development of Django
itself, not development with Django.
As such this mailing list is not appropriate for this message,
django-users would be more appropriate.

-- Gert

Mobile: +32 498725202
Twitter: @gvangool
Web: http://gertvangool.be



On Wed, Aug 24, 2011 at 11:46, Purna Chander <bpurnachan...@gmail.com> wrote:
> Can anyone help me regarding Google Contacts API... How to
> authenticate the google contacts
>
> I tried one code----
>
>   import gdata
> import atom
> import atom.data
> import gdata.data
> import gdata.contacts.client
> import gdata.contacts.data
> import gdata.contacts.service
> # Application name as 'geo-int' for ContactsClient
> #gd_client = gdata.contacts.client.ContactsClient(source='geo-int')
> gd_client = gdata.contacts.service.ContactsService()
> next = 'http://www.example.com/welcome.py'
> scope = 'https://www.google.com/m8/feeds/'
> secure = False
> session = True
> authSubLogin = gd_client.GenerateAuthSubURL(next, scope, secure,
> session)
>
> def OnSave(self, fields):
>    new_contact = gdata.contacts.data.ContactEntry()
>
>    name = self.params.get('name')
>    phone = self.params.get('phone')
>    email_id = self.params.get('email_id')
>    #print email_id
>    #Name
>    new_contact.name =
> gdata.data.Name(full_name=gdata.data.FullName(text=name))
>    #Phone Number
>    new_contact.phone_number.append(gdata.data.PhoneNumber(text=phone,
>      rel=gdata.data.WORK_REL, primay='true'))
>
>    #Email Address
>    new_contact.email.append(gdata.data.Email(address=email_id,
>      primary='true', rel=gdata.data.WORK_REL, display_name=name))
>    new_contact.email.append(gdata.data.Email(address=email_id,
>      rel=gdata.data.HOME_REL))
>
>    # Send the contact data to the server.
>    contact_entry = gd_client.CreateContact(new_contact)
>    print "Contact's ID: %s" % contact_entry.id.text
>    return contact_entry
>
>
> While running this , I am getting the error ---
>
>    Traceback (most recent call last):
>  File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
> base.py", line 99, in get_response
>    response = callback(request, *callback_args, **callback_kwargs)
>  File "/home/boddireddy/Desktop/MainInstance-1/src/view_utils.py",
> line 344, in __call__
>    response = self.Post(self.params)
>  File "/home/boddireddy/Desktop/MainInstance-1/src/view_utils.py",
> line 582, in Post
>    return self.HandleEditFormPost(params)
>  File "/home/boddireddy/Desktop/MainInstance-1/src/views.py", line
> 235, in HandleEditFormPost
>    self.OnSave(form.cleaned_data)  # Modified from above.
>  File "/home/boddireddy/Desktop/MainInstance-1/src/views.py", line
> 259, in OnSave
>    contact_entry = gd_client.CreateContact(new_contact)
>  File "/home/boddireddy/Desktop/MainInstance-1/src/gdata/contacts/
> service.py", line 132, in CreateContact
>    converter=gdata.contacts.ContactEntryFromString)
>  File "/home/boddireddy/Desktop/MainInstance-1/src/gdata/service.py",
> line 1236, in Post
>    media_source=media_source, converter=converter)
>  File "/home/boddireddy/Desktop/MainInstance-1/src/gdata/service.py",
> line 1322, in PostOrPut
>    headers=extra_headers, url_params=url_params)
>  File "/home/boddireddy/Desktop/MainInstance-1/src/atom/__init__.py",
> line 93, in optional_warn_function
>    return f(*args, **kwargs)
>  File "/home/boddireddy/Desktop/MainInstance-1/src/atom/service.py",
> line 176, in request
>    content_length = CalculateDataLength(data)
>  File "/home/boddireddy/Desktop/MainInstance-1/src/atom/service.py",
> line 731, in CalculateDataLength
>    return len(ElementTree.tostring(data))
>  File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 1009, in
> tostring
>    ElementTree(element).write(file, encoding)
>  File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 663, in
> write
>    self._write(file, self._root, encoding, {})
>  File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 673, in
> _write
>    items = node.items()
> AttributeError: 'ContactEntry' object has no attribute 'items'
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django developers" group.
> To post to this group, send email to django-developers@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-developers+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-developers?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to