Created
October 9, 2012 02:43
-
-
Save aisipos/3856272 to your computer and use it in GitHub Desktop.
Small "interactive" HTTP server, starting a Python debugger for each received HTTP request
This file contains hidden or 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
| """ | |
| An interactive HTTP server, starting a python debugger on each http request. | |
| Set the value of "hr" to what you want the HTTP response to be, | |
| and then type "c" to continue | |
| Requires ipdb and bottle | |
| """ | |
| from bottle import * | |
| import ipdb | |
| @route('/favicon.ico') | |
| def favicon(): | |
| return "" | |
| @route('/<path:path>', method=['GET','POST','HEAD','PUT','DELETE']) | |
| def hello(path): | |
| print("Request for %s" % path) | |
| hr = "" | |
| ipdb.set_trace() | |
| return hr | |
| if __name__ == '__main__': | |
| run(host='0.0.0.0', port=8080) # , debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment