1 # Copyright (C) 2008 Google Inc.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
16 __author__
= 'api.jscudder (Jeff Scudder)'
19 import wsgiref
.handlers
20 from google
.appengine
.ext
import webapp
21 from google
.appengine
.api
import users
24 import gdata
.alt
.appengine
28 class Fetcher(webapp
.RequestHandler
):
31 next_url
= atom
.url
.Url('http', settings
.HOST_NAME
, path
='/step1')
33 # Initialize a client to talk to Google Data API services.
34 client
= gdata
.service
.GDataService()
35 gdata
.alt
.appengine
.run_on_appengine(client
)
37 # Generate the AuthSub URL and write a page that includes the link
38 self
.response
.out
.write("""<html><body>
39 <a href="%s">Request token for the Google Documents Scope</a>
40 </body></html>""" % client
.GenerateAuthSubURL(next_url
,
41 ('http://docs.google.com/feeds/',), secure
=False, session
=True))
45 application
= webapp
.WSGIApplication([('/.*', Fetcher
),], debug
=True)
46 wsgiref
.handlers
.CGIHandler().run(application
)
48 if __name__
== '__main__':