Restful Api 最全状态码 请收藏 常用的

class RET:

    OK                         ="200"
    CREATED                    ="201"
    ACCEPTED                   ="202"
    NOCONTENT                  ="204"
    MOVEDPERMANENTLY           ="301"
    SEEOTHER                   ="303"
    NOTMODIFIED                ="304"
    BADREQUEST                 ="400"
    UNAUTHORIZED               ="401"
    FORBIDDEN                  ="403"
    NOTFOUND                   ="404"
    MethodNotAllowed           ="405"
    NOTACCEPTABLE              ="406"
    CONFLICT                   ="409"
    INTERNALSERVERERROR        ="500"
    SERVICEUNAVAILABLE         ="503"

    DBERR                      = "4001"
    NODATA                     = "4002"
    DATAEXIST                  = "4003"
    DATAERR                    = "4004"
    SESSIONERR                 = "4101"
    LOGINERR                   = "4102"
    PARAMERR                   = "4103"
    USERERR                    = "4104"
    ROLEERR                    = "4105"
    PWDERR                     = "4106"
    REQERR                     = "4201"
    IPERR                      = "4202"
    THIRDERR                   = "4301"
    IOERR                      = "4302"
    SERVERERR                  = "4500"
    UNKOWNERR                  = "4501"

error_map = {

    RET.OK                    :u'请求成功',
    RET.CREATED               :u'创建成功',
    RET.ACCEPTED              :u'更新成功',
    RET.NOCONTENT             :U'表示资源有空',
    RET.MOVEDPERMANENTLY      :U'资源的URI已被更新',
    RET.SEEOTHER              :u'其他(如,负载均衡)',
    RET.NOTMODIFIED           :u'资源未更改(缓存)',
    RET.BADREQUEST            :u'坏请求(如,参数错误)',
    RET.UNAUTHORIZED          :u'未授权',
    RET.FORBIDDEN             :u'被禁止访问',
    RET.NOTFOUND              :u'请求的资源不存在',
  RET.METHODNOTALLOWED      :U'请求方法对指定的资源不适用',
  RET.NOTACCEPTABLE         :u'请求格式错误',
RET.CONFLICT : u' 通用冲突 ' , RET.INTERNALSERVERERROR : u' 内部错误 ' , RET.SERVICEUNAVAILABLE : u' 服务当前无法处理请求 ' , RET.DBERR : u" 数据库查询错误 " , RET.NODATA : u" 无数据 " , RET.DATAEXIST : u" 数据已存在 " , RET.DATAERR : u" 数据错误 " , RET.SESSIONERR : u" 用户未登录 " , RET.LOGINERR : u" 用户登录失败 " , RET.PARAMERR : u" 参数错误 " , RET.USERERR : u" 用户不存在或未激活 " , RET.ROLEERR : u" 用户身份错误 " , RET.PWDERR : u" 密码错误 " , RET.REQERR : u" 非法请求或请求次数受限 " , RET.IPERR : u"IP 受限 " , RET.THIRDERR : u" 第三方系统错误 " , RET.IOERR : u" 文件读写错误 " , RET.SERVERERR : u" 内部错误 " , RET.UNKOWNERR : u" 未知错误 " ,}

你可能感兴趣的:(flask)