Python urllib.request.get_full_url() Examples
The following are 12
code examples of urllib.request.get_full_url().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
urllib.request
, or try the search function
.
Example #1
Source File: cookiejar.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
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()
Example #2
Source File: cookiejar.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
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
Example #3
Source File: cookiejar.py From Imogen with MIT License | 5 votes |
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()
Example #4
Source File: cookiejar.py From Imogen with MIT License | 5 votes |
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
Example #5
Source File: cookiejar.py From ironpython3 with Apache License 2.0 | 5 votes |
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()
Example #6
Source File: cookiejar.py From ironpython3 with Apache License 2.0 | 5 votes |
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
Example #7
Source File: test_embeds.py From wagtail with BSD 3-Clause "New" or "Revised" License | 5 votes |
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")
Example #8
Source File: cookiejar.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
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()
Example #9
Source File: cookiejar.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
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
Example #10
Source File: utils_log.py From motu-client-python with GNU Lesser General Public License v3.0 | 5 votes |
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
Example #11
Source File: cookiejar.py From android_universal with MIT License | 5 votes |
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()
Example #12
Source File: cookiejar.py From android_universal with MIT License | 5 votes |
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