Lines Matching refs:url
72 def urlopen(url, data=None, proxies=None, context=None): argument
87 return opener.open(url)
89 return opener.open(url, data)
90 def urlretrieve(url, filename=None, reporthook=None, data=None, context=None): argument
98 return opener.retrieve(url, filename, reporthook, data)
193 urltype, url = splittype(fullurl)
200 url = (host, fullurl) # Signal special case to open_*()
213 return getattr(self, name)(url)
215 return getattr(self, name)(url, data)
221 type, url = splittype(fullurl)
226 type, url = splittype(fullurl)
230 def retrieve(self, url, filename=None, reporthook=None, data=None): argument
233 url = unwrap(toBytes(url))
234 if self.tempcache and url in self.tempcache:
235 return self.tempcache[url]
236 type, url1 = splittype(url)
245 fp = self.open(url, data)
252 garbage, path = splittype(url)
263 self.tempcache[url] = result
295 def open_http(self, url, data=None): argument
300 if isinstance(url, str):
301 host, selector = splithost(url)
307 host, selector = url
312 url = rest
361 return addinfourl(fp, headers, "http:" + url, errcode)
364 return self.http_error(url, fp, errcode, errmsg, headers)
366 return self.http_error(url, fp, errcode, errmsg, headers, data)
368 def http_error(self, url, fp, errcode, errmsg, headers, data=None): argument
377 result = method(url, fp, errcode, errmsg, headers)
379 result = method(url, fp, errcode, errmsg, headers, data)
381 return self.http_error_default(url, fp, errcode, errmsg, headers)
383 def http_error_default(self, url, fp, errcode, errmsg, headers): argument
389 def open_https(self, url, data=None): argument
395 if isinstance(url, str):
396 host, selector = splithost(url)
402 host, selector = url
406 url = rest
454 return addinfourl(fp, headers, "https:" + url, errcode)
457 return self.http_error(url, fp, errcode, errmsg, headers)
459 return self.http_error(url, fp, errcode, errmsg, headers,
462 def open_file(self, url): argument
464 if not isinstance(url, str):
466 if url[:2] == '//' and url[2:3] != '/' and url[2:12].lower() != 'localhost/':
467 return self.open_ftp(url)
469 return self.open_local_file(url)
471 def open_local_file(self, url): argument
478 host, file = splithost(url)
486 mtype = mimetypes.guess_type(url)[0]
495 … raise ValueError("local file url may start with / or file:. Unknown url of type: %s" % url)
508 def open_ftp(self, url): argument
510 if not isinstance(url, str):
517 host, path = splithost(url)
559 mtype = mimetypes.guess_type("ftp:" + url)[0]
566 return addinfourl(fp, headers, "ftp:" + url)
570 def open_data(self, url, data=None): argument
572 if not isinstance(url, str):
587 [type, data] = url.split(',', 1)
613 return addinfourl(f, headers, url)
625 def http_error_default(self, url, fp, errcode, errmsg, headers): argument
627 return addinfourl(fp, headers, "http:" + url, errcode)
629 def http_error_302(self, url, fp, errcode, errmsg, headers, data=None): argument
638 return meth(url, fp, 500,
641 result = self.redirect_internal(url, fp, errcode, errmsg,
647 def redirect_internal(self, url, fp, errcode, errmsg, headers, data): argument
656 newurl = basejoin(self.type + ":" + url, newurl)
671 def http_error_301(self, url, fp, errcode, errmsg, headers, data=None): argument
673 return self.http_error_302(url, fp, errcode, errmsg, headers, data)
675 def http_error_303(self, url, fp, errcode, errmsg, headers, data=None): argument
677 return self.http_error_302(url, fp, errcode, errmsg, headers, data)
679 def http_error_307(self, url, fp, errcode, errmsg, headers, data=None): argument
682 return self.http_error_302(url, fp, errcode, errmsg, headers, data)
684 return self.http_error_default(url, fp, errcode, errmsg, headers)
686 def http_error_401(self, url, fp, errcode, errmsg, headers, data=None): argument
690 URLopener.http_error_default(self, url, fp,
696 URLopener.http_error_default(self, url, fp,
700 URLopener.http_error_default(self, url, fp,
704 return getattr(self,name)(url, realm)
706 return getattr(self,name)(url, realm, data)
708 def http_error_407(self, url, fp, errcode, errmsg, headers, data=None): argument
712 URLopener.http_error_default(self, url, fp,
718 URLopener.http_error_default(self, url, fp,
722 URLopener.http_error_default(self, url, fp,
726 return getattr(self,name)(url, realm)
728 return getattr(self,name)(url, realm, data)
730 def retry_proxy_http_basic_auth(self, url, realm, data=None): argument
731 host, selector = splithost(url)
747 def retry_proxy_https_basic_auth(self, url, realm, data=None): argument
748 host, selector = splithost(url)
764 def retry_http_basic_auth(self, url, realm, data=None): argument
765 host, selector = splithost(url)
777 def retry_https_basic_auth(self, url, realm, data=None): argument
778 host, selector = splithost(url)
1017 def __init__(self, fp, headers, url, code=None): argument
1020 self.url = url
1030 return self.url
1057 def toBytes(url): argument
1061 if _is_unicode(url):
1063 url = url.encode("ASCII")
1065 raise UnicodeError("URL " + repr(url) +
1067 return url
1069 def unwrap(url): argument
1071 url = url.strip()
1072 if url[:1] == '<' and url[-1:] == '>':
1073 url = url[1:-1].strip()
1074 if url[:4] == 'URL:': url = url[4:].strip()
1075 return url
1078 def splittype(url): argument
1085 match = _typeprog.match(url)
1088 return scheme.lower(), url[len(scheme) + 1:]
1089 return None, url
1092 def splithost(url): argument
1099 match = _hostprog.match(url)
1106 return None, url
1171 def splitquery(url): argument
1178 match = _queryprog.match(url)
1180 return url, None
1183 def splittag(url): argument
1190 match = _tagprog.match(url)
1192 return url, None
1194 def splitattr(url): argument
1197 words = url.split(';')