mirror of
https://github.com/xfgryujk/blivechat.git
synced 2025-01-30 14:20:38 +08:00
19 lines
486 B
Python
19 lines
486 B
Python
# -*- coding: utf-8 -*-
|
|
import json
|
|
|
|
import tornado.web
|
|
|
|
|
|
class ApiHandler(tornado.web.RequestHandler): # noqa
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
self.json_args = None
|
|
|
|
def prepare(self):
|
|
if not self.request.headers.get('Content-Type', '').startswith('application/json'):
|
|
return
|
|
try:
|
|
self.json_args = json.loads(self.request.body)
|
|
except json.JSONDecodeError:
|
|
pass
|