Advertisement
Guest User

Untitled

a guest
Sep 20th, 2014
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. class MainPage(webapp2.RequestHandler):
  2. def get(self):
  3. build = createDriveService(user)
  4. searchFile = build.files().get(fileId='FILEID').execute()
  5. self.response.write(searchFile)
  6.  
  7. def createDriveService(userEmail):
  8. API_KEY = 'APIKEY'
  9. credentials = AppAssertionCredentials(
  10. scope='https://www.googleapis.com/auth/drive',
  11. sub=userEmail)
  12. http = httplib2.Http()
  13. http = credentials.authorize(http)
  14.  
  15. return build('drive', 'v2', http=http, developerKey=API_KEY)
  16.  
  17. <"File not found: FILEID">
  18.  
  19. cannot import SignedJwtAsserionCredentials
  20.  
  21. from google.appengine.api import app_identity
  22. logging.info('service account : ' + app_identity.get_service_account_name())
  23.  
  24. def createDriveService():
  25.  
  26. SCOPE = 'https://www.googleapis.com/auth/drive'
  27. API_KEY = 'AIzaSyB9UkK4OH5Z_E4v3Qp6bay6QEgGpzou3bc' # GAE
  28. credentials = AppAssertionCredentials(scope=SCOPE)
  29. logging.info('using service account : ' + app_identity.get_service_account_name())
  30. http = credentials.authorize(httplib2.Http())
  31. return build('drive', 'v2', http=http, developerKey=API_KEY)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement