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
.request
.get_range('inline_logo', 0, 1, default
=0)
23 scale_to
= self
.request
.get_range('scale_logo', 0, 1, default
=0)
24 strip_html
= self
.request
.get_range('strip_html', 0, 1, default
=0)
25 modified
= self
.request
.headers
.get('If-Modified-Since', None)
28 podcasts
, last_modified
= feeddownloader
.parse_feeds(urls
, inline_logo
, scale_to
, strip_html
, modified
)
29 pretty
= json
.dumps(podcasts
, sort_keys
=True, indent
=4)
32 from email
import utils
34 self
.response
.headers
.add_header('Last-Modified', utils
.formatdate(time
.mktime(last_modified
)))
36 self
.response
.out
.write(pretty
)
39 self
.response
.set_status(400)
40 self
.response
.out
.write('parameter url missing')
43 application
= webapp
.WSGIApplication([
50 run_wsgi_app(application
)
52 if __name__
== "__main__":