Lines Matching defs:urlopen
43 def urlopen(url, data=None, proxies=None):
44 """urlopen(url [, data]) -> open file-like object"""
94 # buffer to store data for verification in urlopen tests.
144 """Test urlopen() opening a temporary file.
162 self.returned_obj = urlopen("file:%s" % self.quoted_pathname)
170 # Make sure object returned by urlopen() has the specified methods
174 "object returned by urlopen() lacks %s attribute" %
233 self.assertRaises(ValueError,urllib.request.urlopen,'./' + self.pathname)
344 """Test urlopen() opening a fake http connection."""
349 fp = urlopen("http://python.org/")
362 fp = urllib.request.urlopen(url)
370 resp = urlopen("http://www.python.org")
382 # We explicitly test urllib.request.urlopen() instead of the top
383 # level 'def urlopen()' function defined in this... (quite ugly)
385 # urlopen uses FancyURLOpener which goes via a codepath that
392 urllib.request.urlopen(f"http:{schemeless_url}")
395 urllib.request.urlopen(f"https:{schemeless_url}")
397 resp = urlopen(f"http:{schemeless_url}")
408 # We explicitly test urllib.request.urlopen() instead of the top
409 # level 'def urlopen()' function defined in this... (quite ugly)
411 # urlopen uses FancyURLOpener which goes via a codepath that
417 urllib.request.urlopen(f"http:{schemeless_url}")
419 urllib.request.urlopen(f"https:{schemeless_url}")
421 resp = urlopen(f"http:{schemeless_url}")
439 urlopen(f"http:{schemeless_url}")
441 urlopen(f"https:{schemeless_url}")
454 urlopen(f"http:{schemeless_url}")
456 urlopen(f"https:{schemeless_url}")
472 # urlopen() should raise OSError for many error codes.
480 self.assertRaises(OSError, urlopen, "http://python.org/")
485 # urlopen() should raise OSError for many error codes.
496 urlopen("http://python.org/")
509 self.assertRaises(urllib.error.HTTPError, urlopen,
515 # urlopen() raises OSError if the underlying socket does not send any
519 self.assertRaises(OSError, urlopen, "http://something")
526 urlopen('file://localhost/a/file/which/doesnot/exists.py')
535 with urlopen(tmp_fileurl) as fobj:
542 urlopen(tmp_fileurl)
547 urlopen(test_ftp_url)
553 urlopen('ftp://localhost/a/file/which/doesnot/exists.py')
562 urlopen('ftp://localhost')
569 fp = urlopen("http://user:pass@python.org/")
585 fp = urlopen(url)
605 urllib.request.urlopen(
611 """Test urlopen() opening a data URL."""
639 self.text_url_resp = urllib.request.urlopen(self.text_url)
640 self.text_url_base64_resp = urllib.request.urlopen(
642 self.image_url_resp = urllib.request.urlopen(self.image_url)
645 # Make sure object returned by urlopen() has the specified methods
649 "object returned by urlopen() lacks %s attribute" %
658 self.assertEqual(urllib.request.urlopen("data:,").info().get_params(),
680 self.assertRaises(ValueError,urllib.request.urlopen,'data:text/plain')
684 self.assertRaises(ValueError,urllib.request.urlopen,'data:;base64,Cg=')
1585 # test the safe characters are not quoted by urlopen
1615 self.assertRaises(OSError, urllib.request.urlopen, url)