Hi Lap,
I totally agree. The gdata docs and libs are a complete mess, it is
easy to waste hours (or days!) going in circles following erroneous
and/or incomplete docs. Part of the problem is that different docs
refer to different versions of the libraries and/or protocols. I've
also found bugs (I assume, since the code does not work as documented)
in some of the libraries which add further excitement to the process.
I can give you a few pointers here:
1) Getting everything to work with AuthSub was straightforward, but
alas I needed to use OAuth. :(
a) I'm using 3-legged OAuth with the HMAC-SHA1 sig method.
b) I implemented my own process to get the access token using
the oauth2 lib: https://github.com/simplegeo/python-oauth2
1) I used http://code.google.com/apis/accounts/docs/OAuth.html
as my primary refernece.
c) You should be able to make it work with the client libs, use the doc
above and dig into their code, it will probably save you a
ton of time!
2) Here is some code that works with the contacts API v3 (sorry
don't have a simple example with docs list handy):
auth_token = gdata.gauth.OAuthHmacToken(
consumer_key=SETTINGS['CONSUMER_KEY'],
consumer_secret=SETTINGS['CONSUMER_SECRET'],
token=oauth_data['oauth_token'],
token_secret=oauth_data['oauth_token_secret'],
auth_state=gdata.gauth.ACCESS_TOKEN)
client = gdata.contacts.client.ContactsClient(auth_token=auth_token)
feed = client.get_contacts()
IIRC, when I wrote my code there was some bug in the method their
docs say to use to set the token -- the token would never get set.
Building the auth token and passing it in works well for me, and the
only difference is the order you build your objects in (ie token first
versus client first).
I can't find example code for the older (v1 and v2) style services
right now, but might be able to dig it up if needed.
Good luck.
Robert
On Mon, Feb 7, 2011 at 11:06, Iap <[email protected]> wrote:
> Hi,
> I am looking for an easier tutorial about to get documents list from a
> Google Docs account.
> What I can find are:
>
> #1
> Google Documents List Data API v3.0
> http://code.google.com/apis/documents/docs/3.0/developers_guide_python.html
>
> #2
> OAuth in the Google Data Protocol Client Libraries
> http://code.google.com/apis/gdata/docs/auth/oauth.html
>
> It's frustrated, that the above two documents do not provide a workable
> example to follow.
> The #1 reads that there are 3 methods to authenticate , but as stupid as I
> am,
> failed to figure out the right way to do it correctly. Then, I turned to #2.
>
> The #2 reads great and easier to follow than #2 (from a beginner's point of
> view)
> Until the last section: "Using an access token". They seem to be written by
> different persons.
> There is no "bridge" between that section and others,
> I have difficulty to follow and failed to make my script to work.
>
> It would be appreciated if anybody kindly provides a document
> with more complete example to follow.
> (I have searched Nick's blog , nothing found)
>
> Thanks in advance.
> Iap
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.