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


Python request.get_full_url方法代码示例

本文整理汇总了Python中urllib.request.get_full_url方法的典型用法代码示例。如果您正苦于以下问题:Python request.get_full_url方法的具体用法?Python request.get_full_url怎么用?Python request.get_full_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在urllib.request的用法示例。


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

示例1: request_host

# 需要导入模块: from urllib import request [as 别名]
# 或者: from urllib.request import get_full_url [as 别名]
def request_host(request):
    """Return request-host, as defined by RFC 2965.

    Variation from RFC: returned value is lowercased, for convenient
    comparison.

    """
    url = request.get_full_url()
    host = urllib.parse.urlparse(url)[1]
    if host == "":
        host = request.get_header("Host", "")

    # remove port, if present
    host = cut_port_re.sub("", host, 1)
    return host.lower() 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:17,代码来源:cookiejar.py

示例2: request_path

# 需要导入模块: from urllib import request [as 别名]
# 或者: from urllib.request import get_full_url [as 别名]
def request_path(request):
    """Path component of request-URI, as defined by RFC 2965."""
    url = request.get_full_url()
    parts = urllib.parse.urlsplit(url)
    path = escape_path(parts.path)
    if not path.startswith("/"):
        # fix bad RFC 2396 absoluteURI
        path = "/" + path
    return path 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:11,代码来源:cookiejar.py

示例3: test_endpoint_with_format_param

# 需要导入模块: from urllib import request [as 别名]
# 或者: from urllib.request import get_full_url [as 别名]
def test_endpoint_with_format_param(self, loads, urlopen):
        urlopen.return_value = self.dummy_response
        loads.return_value = {'type': 'video',
                              'url': 'http://www.example.com'}
        result = OEmbedFinder().find_embed("https://vimeo.com/217403396")
        self.assertEqual(result['type'], 'video')
        request = urlopen.call_args[0][0]
        self.assertEqual(request.get_full_url().split('?')[0], "http://www.vimeo.com/api/oembed.json") 
开发者ID:wagtail,项目名称:wagtail,代码行数:10,代码来源:test_embeds.py

示例4: http_request

# 需要导入模块: from urllib import request [as 别名]
# 或者: from urllib.request import get_full_url [as 别名]
def http_request(self, request):
        host, full_url = request.host, request.get_full_url()
        url_path = full_url[full_url.find(host) + len(host):]
        log_url ( self.log, "Requesting: ", request.get_full_url(), TRACE_LEVEL )
        self.log.log(self.log_level, "%s %s" % (request.get_method(), url_path))

        for header in request.header_items():
            self.log.log(self.log_level, " . %s: %s" % header[:])

        return request 
开发者ID:clstoulouse,项目名称:motu-client-python,代码行数:12,代码来源:utils_log.py


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