当前位置: 首页>>代码示例>>Python>>正文


Python Request.response方法代码示例

本文整理汇总了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
开发者ID:rishirajsinghjhelumi,项目名称:Voice-Conversion-WebApp,代码行数:12,代码来源:__init__.py

示例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
开发者ID:suryakencana,项目名称:niimanga,代码行数:14,代码来源:cors.py

示例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
开发者ID:SlowRollBuffalo,项目名称:slowrollbuffalo-web,代码行数:14,代码来源:__init__.py

示例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
开发者ID:Leading120,项目名称:lc_webservice,代码行数:18,代码来源:__init__.py

示例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
开发者ID:kindkiller,项目名称:lc_webservice,代码行数:20,代码来源:__init__.py

示例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
开发者ID:VTacius,项目名称:justine,代码行数:8,代码来源:__init__.py

示例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
开发者ID:VilleDePully,项目名称:c2cgeoportal,代码行数:7,代码来源:test_caching.py

示例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
开发者ID:NaturalSolutions,项目名称:ecoReleve-Server,代码行数:7,代码来源:__init__.py


注:本文中的pyramid.request.Request.response方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。