To make this sample run you will need to populate the client_secrets.json file found at:
%s.
with information found on the APIs Console.
""" % CLIENT_SECRETS http = httplib2.Http(memcache) service = build("buzz", "v1", http=http) decorator = oauth2decorator_from_clientsecrets( CLIENT_SECRETS, 'https://www.googleapis.com/auth/buzz', MISSING_CLIENT_SECRETS_MESSAGE) class MainHandler(webapp.RequestHandler): @decorator.oauth_aware def get(self): path = os.path.join(os.path.dirname(__file__), 'grant.html') variables = { 'url': decorator.authorize_url(), 'has_credentials': decorator.has_credentials() } self.response.out.write(template.render(path, variables)) class FollowerHandler(webapp.RequestHandler): @decorator.oauth_required def get(self): try: http = decorator.http() followers = service.people().list( userId='@me', groupId='@followers').execute(http) text = 'Hello, you have %s followers!' % followers['totalResults'] path = os.path.join(os.path.dirname(__file__), 'welcome.html') self.response.out.write(template.render(path, {'text': text })) except AccessTokenRefreshError: self.redirect('/') def main(): application = webapp.WSGIApplication( [ ('/', MainHandler), ('/followers', FollowerHandler), ], debug=True) run_wsgi_app(application) if __name__ == '__main__': main()