當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。