Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 22nd, 2012  |  syntax: None  |  size: 1.59 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2. #!/usr/bin/python
  3. #
  4. # Copyright (C) 2009 Google Inc.
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. #      http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17.  
  18. # Note:
  19. # This sample demonstrates 2 Legged OAuth using v2 of the Google Data APIs.
  20. # See 2_legged_oauth.py for an example of using 2LO with v1.0 of the APIs.
  21.  
  22. from google.appengine.ext import webapp
  23. from google.appengine.ext.webapp.util import run_wsgi_app, login_required
  24. from google.appengine.api import users
  25. from xml.etree import ElementTree
  26. import gdata.gauth
  27. import gdata.contacts.client
  28. import gdata.docs.client
  29.  
  30. CONSUMER_KEY = 'deleted'
  31. CONSUMER_SECRET = 'deleted'
  32.  
  33. requestor_id = 'deleted'
  34.  
  35. client = gdata.docs.client.DocsClient(source='gdatatest17')
  36. client.auth_token = gdata.gauth.TwoLeggedOAuthHmacToken(
  37.     CONSUMER_KEY, CONSUMER_SECRET, requestor_id)
  38.  
  39.  
  40. # Retrieve user's list of Google Docs
  41. feed = client.GetDocList()
  42. for entry in feed.entry:
  43.   print entry.title.text
  44.  
  45. def main():
  46.     application = webapp.WSGIApplication([('/', self),],
  47.                                          deabug=True)
  48.     run_wsgi_app(application)
  49.  
  50. if __name__ == '__main__':
  51.     main()