Created
December 5, 2014 03:26
-
-
Save RaviH/289f98951ac6c986b212 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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