Skip to content

Instantly share code, notes, and snippets.

@RaviH
Created December 5, 2014 03:26
Show Gist options
  • Save RaviH/289f98951ac6c986b212 to your computer and use it in GitHub Desktop.
Save RaviH/289f98951ac6c986b212 to your computer and use it in GitHub Desktop.
from bottle import Bottle, run, request, response, HTTPResponse
APP1 = Bottle()
@APP1.hook('before_request')
def before_request():
print "APP 1 - Before Request {}".format(request.url)
@APP1.hook('after_request')
def after_request():
print "APP 1 - After Request {} - status code: {}".format(request.url, response.status_code)
@APP1.route('/error')
def error():
raise HTTPResponse(status=400)
if __name__ == "__main__":
run(APP1, host='localhost', port=8080)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment