• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python request.Request类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中aspen.http.request.Request的典型用法代码示例。如果您正苦于以下问题:Python Request类的具体用法?Python Request怎么用?Python Request使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Request类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: serve_request

 def serve_request(self, path):
     """Given an URL path, return response.
     """
     request = Request(uri=path)
     request.website = self
     response = self.handle_safely(request)
     return response
开发者ID:joonas,项目名称:aspen,代码行数:7,代码来源:website.py


示例2: load_simplate

 def load_simplate(self, path, request=None, return_request_too=False):
     """Given an URL path, return a simplate (Resource) object.
     """
     if request is None:
         request = Request(uri=path)
     if not hasattr(request, 'website'):
         request.website = self
     self.do_inbound(request)
     resource = resources.get(request)
     if return_request_too:
         return resource, request
     else:
         return resource
开发者ID:joonas,项目名称:aspen,代码行数:13,代码来源:website.py


示例3: get_request

 def get_request(self, path, method="GET", body=None, **extra):
     env = StubWSGIRequest(path)
     env["REQUEST_METHOD"] = method
     env["wsgi.input"] = StringIO(body)
     env["HTTP_COOKIE"] = self.cookies.output(header="", sep="; ")
     env.update(extra)
     return Request.from_wsgi(env)
开发者ID:nejstastnejsistene,项目名称:aspen-python,代码行数:7,代码来源:client.py


示例4: get_request

 def get_request(self, path, method="GET", body=None,
                 **extra):
     env = StubWSGIRequest(path)
     env['REQUEST_METHOD'] = method
     env['wsgi.input'] = StringIO(body)
     env['HTTP_COOKIE'] = self.cookies.output(header='', sep='; ')
     env.update(extra)
     return Request.from_wsgi(env)
开发者ID:ChimeraCoder,项目名称:www.gittip.com,代码行数:8,代码来源:client.py


示例5: __call__

 def __call__(self, environ, start_response):
     """WSGI interface.
     """
     request = Request.from_wsgi(environ) # too big to fail :-/
     response = self.handle_safely(request)
     response.request = request # Stick this on here at the last minute
                                # in order to support close hooks.
     return response(environ, start_response)
开发者ID:allisonmobley,项目名称:aspen,代码行数:8,代码来源:website.py


示例6: get_request

 def get_request(self, path, method="GET", body=None,
                 **extra):
     env = StubWSGIRequest(path.encode('utf8'))
     env[b'REQUEST_METHOD'] = method.encode('utf8')
     env[b'wsgi.input'] = StringIO(body)
     env[b'HTTP_COOKIE'] = self.cookies.output(header='', sep='; ').encode('utf8')
     for k,v in extra.items():
         env[k.encode('utf8')] = v.encode('utf8')
     return Request.from_wsgi(env)
开发者ID:angleman,项目名称:www.gittip.com,代码行数:9,代码来源:client.py


示例7: from_fs

 def from_fs(cls, fs):
     """Takes a path under ./fsfix using / as the path separator.
     """
     fs = os.sep.join(fs.split('/'))
     request = Request.from_wsgi(StubWSGIRequest(fs))
     c = Configurable.from_argv(['fsfix'])
     c.copy_configuration_to(request)
     request.fs = fs
     request.namespace = {}
     request.website = Stub()
     request.website.template_loader = Stub()
     return request
开发者ID:falstaff84,项目名称:aspen,代码行数:12,代码来源:__init__.py


示例8: from_fs

 def from_fs(cls, fs):
     """Takes a path under ./fsfix using / as the path separator.
     """
     fs = os.sep.join(fs.split(os.sep))
     request = Request.from_wsgi(StubWSGIRequest(fs))
     website = Configurable.from_argv(['--root', 'fsfix'])
     website.copy_configuration_to(request)
     request.root = join(dirname(__file__), 'fsfix')
     request.fs = fs
     request.namespace = {}
     request.website = website 
     request.website.template_loader = Stub()
     return request
开发者ID:jatr,项目名称:aspen,代码行数:13,代码来源:__init__.py


示例9: from_fs

 def from_fs(cls, fs, *a):
     """Takes a path under FSFIX using / as the path separator.
     """
     fs = os.sep.join(fs.split(os.sep))
     request = Request.from_wsgi(StubWSGIRequest(fs))
     website = Configurable.from_argv([ '--www_root', FSFIX
                                      , '--project_root', '.aspen'
                                       ] + list(a))
     request.www_root = os.path.join(os.path.dirname(__file__), FSFIX)
     request.fs = fs
     request.context = {}
     request.website = website 
     request._media_type = None
     return request
开发者ID:jarpineh,项目名称:aspen,代码行数:14,代码来源:__init__.py


示例10: wsgi_app

    def wsgi_app(self, environ, start_response):
        """WSGI interface.

        Wrap this method instead of the website object itself
        when to use WSGI middleware::

            website = Website()
            website.wsgi_app = WSGIMiddleware(website.wsgi_app)

        """
        request = Request.from_wsgi(environ) # too big to fail :-/
        request.website = self
        response = self.handle_safely(request)
        response.request = request # Stick this on here at the last minute
                                   # in order to support close hooks.
        return response(environ, start_response)
开发者ID:Web5design,项目名称:aspen-python,代码行数:16,代码来源:website.py


示例11: from_fs

 def from_fs(cls, fs, *a):
     """Takes a path under FSFIX using / as the path separator.
     """
     fs = os.sep.join(fs.split(os.sep))
     uri_path = fs
     if fs.endswith('.spt'):
         uri_path = fs[:-4]
     request = Request.from_wsgi(StubWSGIRequest(uri_path))
     website = Website([ '--www_root', FSFIX
                       , '--project_root', os.path.join(FSFIX, '.aspen')
                        ] + list(a))
     request.www_root = os.path.join(os.path.dirname(__file__), FSFIX)
     request.fs = fs
     request.context = {}
     request.website = website
     request._media_type = None
     return request
开发者ID:prodigeni,项目名称:aspen-python,代码行数:17,代码来源:__init__.py


示例12: parse_environ_into_request

def parse_environ_into_request(environ):
    return {'request': Request.from_wsgi(environ)}
开发者ID:joeyespo,项目名称:aspen-python,代码行数:2,代码来源:website.py


示例13: __call__

 def __call__(self, environ, start_response):
     """WSGI interface.
     """
     request = Request.from_wsgi(environ) # too big to fail :-/
     response = self.handle(request)
     return response(environ, start_response)
开发者ID:falstaff84,项目名称:aspen,代码行数:6,代码来源:website.py


示例14: __call__

 def __call__(cls, uripath=b'/'):
     typecheck(uripath, str)
     return Request.from_wsgi(StubWSGIRequest(uripath))
开发者ID:prodigeni,项目名称:aspen-python,代码行数:3,代码来源:__init__.py


示例15: make_request

def make_request(filename='echo.sock'):
    request = Request(url='/echo.sock')
    request.website = Website([])
    request.website.copy_configuration_to(request)
    request.fs = fix(filename)
    return request
开发者ID:buchuki,项目名称:aspen,代码行数:6,代码来源:sockets.py


示例16: make_request

def make_request():
    return Request.from_diesel(DieselReq())
开发者ID:dowski,项目名称:aspen,代码行数:2,代码来源:test_request.py


示例17: make_request

def make_request(filename='echo.sock'):
    request = Request(uri='/echo.sock')
    request.website = Website([])
    request.fs = fix(filename)
    return request
开发者ID:gunshor,项目名称:aspen,代码行数:5,代码来源:sockets.py


示例18: handle

def handle(path):
    website = Website(Configuration(['fsfix']))
    return website.handle(Request.from_diesel(DieselReq(path)))
开发者ID:dowski,项目名称:aspen,代码行数:3,代码来源:__init__.py


示例19: get_simplate_context

def get_simplate_context(website, fs):
    request = Request()
    request.fs = fs
    request.website = website
    resource = resources.get(request)
    return {} if isinstance(resource, StaticResource) else resource.pages[0]
开发者ID:carols10cents,项目名称:inside.gratipay.com,代码行数:6,代码来源:nav.py


示例20: __call__

 def __call__(self, diesel_request):
     """Given a Diesel request, return a Diesel response.
     """
     request = Request.from_diesel(diesel_request) # too big to fail :-/
     response = self.handle(request)
     return response._to_diesel(diesel_request) # sends bits, returns bool
开发者ID:dowski,项目名称:aspen,代码行数:6,代码来源:website.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python json.loads函数代码示例发布时间:2022-05-24
下一篇:
Python configuration.Configurable类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap