1 from google
.appengine
.ext
import webapp
2 from google
.appengine
.ext
.webapp
.util
import run_wsgi_app
6 import simplejson
as json
8 class MainPage(webapp
.RequestHandler
):
10 self
.response
.headers
['Content-Type'] = 'text/plain'
11 self
.response
.out
.write('Hello, webapp World!')
13 class Parse(webapp
.RequestHandler
):
19 self
.response
.headers
['Content-Type'] = 'text/plain'
20 urls
= self
.request
.get_all('url')
21 urls
= map(urllib
.unquote
, urls
)
22 inline_logo
= self
.get_int('inline_logo')
23 scale_to
= self
.get_int('scale_logo', None)
26 podcasts
= [feeddownloader
.parse_feed(url
, inline_logo
, scale_to
) for url
in urls
]
27 pretty
= json
.dumps(podcasts
, sort_keys
=True, indent
=4)
28 self
.response
.out
.write(pretty
)
30 self
.response
.set_status(400)
31 self
.response
.out
.write('parameter url missing')
33 def get_int(self
, param
, default
=0):
35 return int(self
.request
.get(param
, default
))
40 application
= webapp
.WSGIApplication([
47 run_wsgi_app(application
)
49 if __name__
== "__main__":