Django API 自定义状态码

时间:2019-12-21 18:48:30   收藏:0   阅读:463
class BaseResponse(object):

    def __init__(self):
        self.code = 1000
        self.data = None
        self.error = None

    @property
    def dict(self):
        return self.__dict__


class TokenResponse(BaseResponse):
    def __init__(self):
        super(BaseResponse).__init__()
        self.code = 1000
        self.token = None

 

class PricePolicyIncalid(Exception):
    def __init__(self, msg):
        self.msg = msg

原文:https://www.cnblogs.com/Rivend/p/12077808.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!