本文整理汇总了Python中pyramid.request.Request.response方法的典型用法代码示例。如果您正苦于以下问题:Python Request.response方法的具体用法?Python Request.response怎么用?Python Request.response使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyramid.request.Request
的用法示例。
在下文中一共展示了Request.response方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: request_factory
# 需要导入模块: from pyramid.request import Request [as 别名]
# 或者: from pyramid.request.Request import response [as 别名]
def request_factory(environ):
request = Request(environ)
request.response = Response()
request.response.headerlist = []
request.response.headerlist.extend(
(
('Access-Control-Allow-Origin', '*'),
)
)
return request
示例2: _req_factory
# 需要导入模块: from pyramid.request import Request [as 别名]
# 或者: from pyramid.request.Request import response [as 别名]
def _req_factory(environ):
R = Request(environ)
if R.is_xhr:
R.response = Response()
R.response.headerlist = []
R.response.headerlist.extend(
(
('Access-Control-Allow-Origin', '*'),
('Content-Type', 'application/json')
)
)
return R
示例3: request_factory
# 需要导入模块: from pyramid.request import Request [as 别名]
# 或者: from pyramid.request.Request import response [as 别名]
def request_factory(environ):
request = Request(environ)
if request.is_xhr:
request.response = Response()
request.response.headerlist = []
request.response.headerlist.extend(
(
('Access-Control-Allow-Origin', '*'),
#('Content-Type', 'application/json')
)
)
return request
示例4: request_factory
# 需要导入模块: from pyramid.request import Request [as 别名]
# 或者: from pyramid.request.Request import response [as 别名]
def request_factory(environ):
request = Request(environ)
# if request.is_xhr:
# if request.method == 'OPTIONS':
request.response = Response()
# request.response.headerlist = []
request.response.headerlist.extend(
(
("Access-Control-Allow-Origin", "http://localhost:8000"),
# ("Access-Control-Allow-Methods", "GET, PUT, POST, DELETE"),
# ("Access-Control-Expose-Headers", "Authorization"),
# ("Access-Control-Allow-Credentials", 'true'),
("Access-Control-Allow-Headers", "Authorization"),
)
)
return request
示例5: request_factory
# 需要导入模块: from pyramid.request import Request [as 别名]
# 或者: from pyramid.request.Request import response [as 别名]
def request_factory(environ):
request = Request(environ)
#if request.is_xhr:
#if request.method == 'OPTIONS':
request.response = Response()
#request.response.headerlist = []
request.response.headerlist.extend(
(
#("Access-Control-Allow-Origin", "http://www.lukchic.com"),
#("Access-Control-Allow-Origin", "http://192.168.56.101:8080"),
("Access-Control-Allow-Origin", "http://localhost:8000"),
#("Access-Control-Allow-Methods", "GET, PUT, POST"),
("Access-Control-Allow-Headers", "Access-Control-Allow-Origin, Authorization")
#("Access-Control-Allow-Credentials", 'true'),
#("Access-Control-Allow-Headers", "Authorization")
)
)
return request
示例6: request_factory
# 需要导入模块: from pyramid.request import Request [as 别名]
# 或者: from pyramid.request.Request import response [as 别名]
def request_factory(environ):
environ['HTTP_ACCEPT'] = 'application/json'
request = Request(environ)
request.response = Response()
request.add_response_callback(finish_callback)
return request
示例7: _do
# 需要导入模块: from pyramid.request import Request [as 别名]
# 或者: from pyramid.request.Request import response [as 别名]
def _do(self, method, headers, credentials=False, settings=SETTINGS):
req = Request({}, method=method, headers=headers)
req.response = Response()
set_cors_headers(settings, req, "foo", credentials, req.response)
return req.response.headers
示例8: request_factory
# 需要导入模块: from pyramid.request import Request [as 别名]
# 或者: from pyramid.request.Request import response [as 别名]
def request_factory(env):
request = Request(env)
request.response = Response()
request.response.headerlist.extend([('Access-Control-Allow-Origin', '*')])
return request