Skip to content

Instantly share code, notes, and snippets.

@aisipos
Created October 9, 2012 02:43
Show Gist options
  • Select an option

  • Save aisipos/3856272 to your computer and use it in GitHub Desktop.

Select an option

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
"""
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