本文整理汇总了Python中django.core.handlers.wsgi.STATUS_CODE_TEXT.items方法的典型用法代码示例。如果您正苦于以下问题:Python STATUS_CODE_TEXT.items方法的具体用法?Python STATUS_CODE_TEXT.items怎么用?Python STATUS_CODE_TEXT.items使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.core.handlers.wsgi.STATUS_CODE_TEXT
的用法示例。
在下文中一共展示了STATUS_CODE_TEXT.items方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AttrDict
# 需要导入模块: from django.core.handlers.wsgi import STATUS_CODE_TEXT [as 别名]
# 或者: from django.core.handlers.wsgi.STATUS_CODE_TEXT import items [as 别名]
from django.core.handlers.wsgi import STATUS_CODE_TEXT
from restlib2.structures import AttrDict
# New codes - http://tools.ietf.org/html/draft-nottingham-http-new-status-04
STATUS_CODE_TEXT.setdefault(422, 'UNPROCESSABLE ENTITY')
STATUS_CODE_TEXT.setdefault(428, 'PRECONDITION REQUIRED')
STATUS_CODE_TEXT.setdefault(429, 'TOO MANY REQUESTS')
STATUS_CODE_TEXT.setdefault(431, 'REQUEST HEADER FIELDS TOO LARGE')
STATUS_CODE_TEXT.setdefault(511, 'NETWORK AUTHENTICATION REQUIRED')
# Invert dict for reference by name
codes = AttrDict('HTTP Status Codes', [
(y.lower().replace(' ', '_'), x) for x, y in STATUS_CODE_TEXT.items()
])
# PATCH Method introduced - http://tools.ietf.org/html/rfc5789
methods = AttrDict('HTTP Methods',
GET = 'GET',
HEAD = 'HEAD',
OPTIONS = 'OPTIONS',
POST = 'POST',
PUT = 'PUT',
DELETE = 'DELETE',
PATCH = 'PATCH',
)
示例2: AttrDict
# 需要导入模块: from django.core.handlers.wsgi import STATUS_CODE_TEXT [as 别名]
# 或者: from django.core.handlers.wsgi.STATUS_CODE_TEXT import items [as 别名]
from django.core.handlers.wsgi import STATUS_CODE_TEXT
from restlib2.structures import AttrDict
STATUS_CODE_TEXT.setdefault(422, 'UNPROCESSABLE ENTITY')
# http://tools.ietf.org/html/rfc6585
STATUS_CODE_TEXT.setdefault(428, 'PRECONDITION REQUIRED')
STATUS_CODE_TEXT.setdefault(429, 'TOO MANY REQUESTS')
STATUS_CODE_TEXT.setdefault(431, 'REQUEST HEADER FIELDS TOO LARGE')
STATUS_CODE_TEXT.setdefault(511, 'NETWORK AUTHENTICATION REQUIRED')
# http://tools.ietf.org/html/draft-tbray-http-legally-restricted-status-02
STATUS_CODE_TEXT.setdefault(451, 'UNAVAILABLE FOR LEGAL REASONS')
# Invert dict for reference by name
codes = AttrDict('HTTP Status Codes',
[(y, x) for x, y in STATUS_CODE_TEXT.items()])
# PATCH Method introduced - http://tools.ietf.org/html/rfc5789
methods = AttrDict('HTTP Methods',
GET = 'GET',
HEAD = 'HEAD',
OPTIONS = 'OPTIONS',
POST = 'POST',
PUT = 'PUT',
DELETE = 'DELETE',
PATCH = 'PATCH',
)