Created
May 16, 2018 14:05
-
-
Save herberthamaral/84f3a211c86a6663bf6994b7494829a0 to your computer and use it in GitHub Desktop.
A simple (even lacking) web server for debugging clients (yes, really).
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
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