Skip to content

Instantly share code, notes, and snippets.

@averrin
Last active October 12, 2015 17:48
Show Gist options
  • Select an option

  • Save averrin/4064679 to your computer and use it in GitHub Desktop.

Select an option

Save averrin/4064679 to your computer and use it in GitHub Desktop.
Bottle.dummy
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