Skip to content

Instantly share code, notes, and snippets.

@Pretz
Forked from nuance/simulate_errorcodes.py
Created December 17, 2009 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pretz/259126 to your computer and use it in GitHub Desktop.
Save Pretz/259126 to your computer and use it in GitHub Desktop.
import web
import httplib
urls = ("/(.+?)/?", "http_err")
app = web.application(urls, globals())
class http_err:
def GET(self, err_code):
err_code = int(err_code.split("/")[0])
response = "%d %s" % (err_code, httplib.responses[err_code])
raise web.HTTPError(response)
if __name__ == "__main__":
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment