Hi,
There are many changes with the new v2 classes, I've adapted the
following:
http://gdatatips.blogspot.com/2008/11/2-legged-oauth-in-python.html
and created a small Python 2-legged example (I think we need to get
some help from the Python lib contributors to make a better one):
self.gd_client = gdata.contacts.client.ContactsClient();
CONSUMER_KEY = 'DOMAIN.com'
CONSUMER_SECRET = 'WiR/....'
CONTACTS_URL = '
http://www.google.com/m8/feeds/profiles/domain/
DOMAIN.com/full/'
user = 'AD...@DOMAIN.com'
params = {'max-results': 100, 'xoauth_requestor_id': user}
oauthconsumer = gdata.auth.oauth.OAuthConsumer
(CONSUMER_KEY,CONSUMER_SECRET)
request = gdata.oauth.OAuthRequest.from_consumer_and_token
( oauthconsumer, http_method='GET', http_url=CONTACTS_URL,
parameters=params)
request.sign_request(gdata.oauth.OAuthSignatureMethod_HMAC_SHA1(),
oauthconsumer, None)
headers = request.to_header()
uri = '%s?%s' % (request.http_url, urllib.urlencode(params))
http_request = atom.http_core.HttpRequest(headers=headers)
feed = self.gd_client.GetFeed(uri, http_request=http_request,
desired_class=gdata.contacts.data.ContactsFeed)
for entry in feed.entry:
self.PrintEntry( entry )
def PrintEntry(self, entry):
print '\n%s' % (entry.title.text)
Please if you used this to make a better example, share it back :)
Cheers,
Julian
> > > > >
google-contacts...@googlegroups.com<google-contacts-api%2Bunsu
bsc...@googlegroups.com><google-contacts-api%2Bunsu