Skip to content

Instantly share code, notes, and snippets.

@onishi
Created February 16, 2011 03:35
Show Gist options
  • Save onishi/828817 to your computer and use it in GitHub Desktop.
Save onishi/828817 to your computer and use it in GitHub Desktop.
statuscode
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
import httplib
class StatusCode(webapp.RequestHandler):
def get(self, code):
self.response.headers['Content-Type'] = 'text/html'
content = 'statuscode : ' + code + '<br>'
for c, m in httplib.responses.iteritems():
content += "<li><a href=\"/statuscode/%(code)d\">%(code)d %(message)s</a></li>\n" % {'code':c, 'message':m}
self.response.out.write(content)
if code:
self.response.set_status(int(code), message=None)
application = webapp.WSGIApplication([
(r'/statuscode/?(\d*)', StatusCode),
], debug=True)
def main():
run_wsgi_app(application)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment