Last active
October 12, 2015 17:48
-
-
Save averrin/4064679 to your computer and use it in GitHub Desktop.
Bottle.dummy
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
| from bottle import run, Bottle, route, request | |
| from datetime import datetime | |
| from termcolor import colored | |
| from pprint import pprint | |
| import json | |
| PORT = 8989 | |
| @route('/:action', method=['GET', 'POST']) | |
| def dummy(action): | |
| print '[%s]: /%s -- %s' % (datetime.now().strftime("%H:%M:%S"), colored(action, 'green'), colored(request.method, 'blue')) | |
| if request.POST.dict: | |
| pprint(json.loads(request.POST.dict.keys()[0])) | |
| return {'err_no': 0, 'dsc': ''} | |
| run(port=PORT, reloader=True, host='0.0.0.0') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment