update
This commit is contained in:
parent
fa89f4b648
commit
55479f49b7
12
tool.py
12
tool.py
|
@ -2,21 +2,17 @@ import json
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
import pydantic
|
|
||||||
import requests
|
import requests
|
||||||
from pydantic import BaseModel
|
|
||||||
|
|
||||||
from config import mp4_path, post_record_list_url, post_record_url, info_topic
|
from config import mp4_path, post_record_list_url, post_record_url, info_topic
|
||||||
|
|
||||||
|
|
||||||
class BaseResponse(BaseModel):
|
|
||||||
code: int = pydantic.Field(200, description="MQTT Return Status Code")
|
|
||||||
msg: str = pydantic.Field("success", description="MQTT Status Message")
|
|
||||||
|
|
||||||
|
|
||||||
# 统一返回
|
# 统一返回
|
||||||
def publish_payload(code, msg):
|
def publish_payload(code, msg):
|
||||||
return json.dumps(BaseResponse(code=code, msg=msg), ensure_ascii=False)
|
return json.dumps({
|
||||||
|
"code": 200,
|
||||||
|
"msg": msg
|
||||||
|
}, ensure_ascii=False)
|
||||||
|
|
||||||
|
|
||||||
def exception_handler(func):
|
def exception_handler(func):
|
||||||
|
|
Loading…
Reference in New Issue