Lines Matching refs:url

250 _DefragResultBase = namedtuple('DefragResult', 'url fragment')
257 DefragResult(url, fragment)
259 A 2-tuple that contains the url without fragment identifier and the fragment
263 _DefragResultBase.url.__doc__ = """The URL with no fragment identifier."""
327 return self.url + '#' + self.fragment
329 return self.url
346 return self.url + b'#' + self.fragment
348 return self.url
374 def urlparse(url, scheme='', allow_fragments=True):
380 depending on the type of the url parameter.
386 component when no scheme is found in url.
394 url, scheme, _coerce_result = _coerce_args(url, scheme)
395 splitresult = urlsplit(url, scheme, allow_fragments)
396 scheme, netloc, url, query, fragment = splitresult
397 if scheme in uses_params and ';' in url:
398 url, params = _splitparams(url)
401 result = ParseResult(scheme, netloc, url, params, query, fragment)
404 def _splitparams(url):
405 if '/' in url:
406 i = url.find(';', url.rfind('/'))
408 return url, ''
410 i = url.find(';')
411 return url[:i], url[i+1:]
413 def _splitnetloc(url, start=0):
414 delim = len(url) # position of end of domain part of url, default is end
416 wdelim = url.find(c, start) # find first of this delim
419 return url[start:delim], url[delim:] # return (domain, rest)
440 # https://www.rfc-editor.org/rfc/rfc3986#page-49 and https://url.spec.whatwg.org/
453 def urlsplit(url, scheme='', allow_fragments=True):
459 depending on the type of the url parameter.
465 component when no scheme is found in url.
474 url, scheme, _coerce_result = _coerce_args(url, scheme)
475 # Only lstrip url as some applications rely on preserving trailing space.
476 # (https://url.spec.whatwg.org/#concept-basic-url-parser would strip both)
477 url = url.lstrip(_WHATWG_C0_CONTROL_OR_SPACE)
481 url = url.replace(b, "")
486 i = url.find(':')
487 if i > 0 and url[0].isascii() and url[0].isalpha():
488 for c in url[:i]:
492 scheme, url = url[:i].lower(), url[i+1:]
493 if url[:2] == '//':
494 netloc, url = _splitnetloc(url, 2)
501 if allow_fragments and '#' in url:
502 url, fragment = url.split('#', 1)
503 if '?' in url:
504 url, query = url.split('?', 1)
506 v = SplitResult(scheme, netloc, url, query, fragment)
514 scheme, netloc, url, params, query, fragment, _coerce_result = (
517 url = "%s;%s" % (url, params)
518 return _coerce_result(urlunsplit((scheme, netloc, url, query, fragment)))
526 scheme, netloc, url, query, fragment, _coerce_result = (
528 if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'):
529 if url and url[:1] != '/': url = '/' + url
530 url = '//' + (netloc or '') + url
532 url = scheme + ':' + url
534 url = url + '?' + query
536 url = url + '#' + fragment
537 return _coerce_result(url)
539 def urljoin(base, url, allow_fragments=True):
543 return url
544 if not url:
547 base, url, _coerce_result = _coerce_args(base, url)
551 urlparse(url, bscheme, allow_fragments)
554 return _coerce_result(url)
608 def urldefrag(url):
615 url, _coerce_result = _coerce_args(url)
616 if '#' in url:
617 s, n, p, a, q, frag = urlparse(url)
621 defrag = url
1017 def to_bytes(url):
1020 return _to_bytes(url)
1023 def _to_bytes(url):
1028 if isinstance(url, str):
1030 url = url.encode("ASCII").decode()
1032 raise UnicodeError("URL " + repr(url) +
1034 return url
1037 def unwrap(url):
1042 url = str(url).strip()
1043 if url[:1] == '<' and url[-1:] == '>':
1044 url = url[1:-1].strip()
1045 if url[:4] == 'URL:':
1046 url = url[4:].strip()
1047 return url
1050 def splittype(url):
1054 return _splittype(url)
1058 def _splittype(url):
1064 match = _typeprog.match(url)
1068 return None, url
1071 def splithost(url):
1075 return _splithost(url)
1079 def _splithost(url):
1085 match = _hostprog.match(url)
1091 return None, url
1167 def splitquery(url):
1171 return _splitquery(url)
1174 def _splitquery(url):
1176 path, delim, query = url.rpartition('?')
1179 return url, None
1182 def splittag(url):
1186 return _splittag(url)
1189 def _splittag(url):
1191 path, delim, tag = url.rpartition('#')
1194 return url, None
1197 def splitattr(url):
1201 return _splitattr(url)
1204 def _splitattr(url):
1207 words = url.split(';')