Skip to content

Instantly share code, notes, and snippets.

@herberthamaral
Created May 16, 2018 14:05
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 herberthamaral/84f3a211c86a6663bf6994b7494829a0 to your computer and use it in GitHub Desktop.
Save herberthamaral/84f3a211c86a6663bf6994b7494829a0 to your computer and use it in GitHub Desktop.
A simple (even lacking) web server for debugging clients (yes, really).
import json
from werkzeug.wrappers import Request, Response
@Request.application
def application(request):
print('HEADERS:')
for header, value in request.headers.items():
print('{header}: {value}'.format(header=header, value=value))
print('CONTENT:')
print(json.dumps(request.values.to_dict()))
print('_'*80)
return Response('')
if __name__ == '__main__':
from werkzeug.serving import run_simple
run_simple('localhost', 4000, application)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment