Created
March 26, 2018 05:18
-
-
Save nguyentienlong/18d6e5c94cb99737bdd2a42a9b486365 to your computer and use it in GitHub Desktop.
BookingResource
This file contains 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 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