Skip to content

Instantly share code, notes, and snippets.

@nguyentienlong
Created March 26, 2018 05:18
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 nguyentienlong/18d6e5c94cb99737bdd2a42a9b486365 to your computer and use it in GitHub Desktop.
Save nguyentienlong/18d6e5c94cb99737bdd2a42a9b486365 to your computer and use it in GitHub Desktop.
BookingResource
from app import log
logger = log.get_logger()
class BookingResource(object):
def __init(self):
pass
def on_put(self, req, resp, booking_id):
try:
data = req.stream().read()
data = json.loads(data.decode('utf-8'))
if data['status'] == 'init':
# do something with this init state
if data['status'] == 'deposited':
# do something with this deposited state
if data['status'] == 'accepted':
# do something with this accepted state
if data['status'] == 'done':
# do something with this accepted state
except Exception as e:
logger.exception(e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment