Lines Matching defs:request
16 import urllib.request
19 from urllib.request import (Request, OpenerDirector, HTTPBasicAuthHandler,
39 for module in 'request', 'response', 'parse', 'error', 'robotparser':
43 if module == 'request' and os.name == 'nt':
56 self.addCleanup(urllib.request.urlcleanup)
58 self.assertRaises(ValueError, urllib.request.urlopen, 'bogus url')
61 fname = os.path.abspath(urllib.request.__file__).replace(os.sep, '/')
68 with urllib.request.urlopen(file_url) as f:
80 self.assertEqual(urllib.request.parse_http_list(string), list)
147 mgr = urllib.request.HTTPPasswordMgr()
238 mgr = urllib.request.HTTPPasswordMgr()
313 def add_cookie_header(self, request):
314 self.ach_req = request
316 def extract_cookies(self, response, request):
317 self.ec_req, self.ec_r = request, response
373 def request(self, method, url, body=None, headers=None, *,
419 elif action == "return request":
460 [["http_error"], [("http_open", "return request")]]
488 class MockHTTPHandler(urllib.request.BaseHandler):
516 class MockHTTPSHandler(urllib.request.AbstractHTTPHandler):
517 # Useful for testing the Proxy-Authorization request by verifying the
521 urllib.request.AbstractHTTPHandler.__init__(self, debuglevel=debuglevel)
528 class MockHTTPHandlerCheckAuth(urllib.request.BaseHandler):
531 # checks if auth header is specified in request
585 o.add_handler(urllib.request.UnknownHandler())
634 # raising URLError stops processing of request
673 [("http_request", "return request"),
675 [("http_request", "return request"),
683 # not just the first handler that handles the request
710 urlpath = urllib.request.pathname2url(path)
731 class NullFTPHandler(urllib.request.FTPHandler):
785 h = urllib.request.FileHandler()
849 h = urllib.request.FileHandler()
877 h = urllib.request.AbstractHTTPHandler()
945 h = urllib.request.AbstractHTTPHandler()
972 h = urllib.request.AbstractHTTPHandler()
995 h = urllib.request.AbstractHTTPHandler()
1015 h = urllib.request.AbstractHTTPHandler()
1033 h = urllib.request.AbstractHTTPHandler()
1042 h = urllib.request.AbstractHTTPHandler()
1063 h = urllib.request.AbstractHTTPHandler()
1096 # testing a reusable request instance, but the url parameter is
1120 h = urllib.request.AbstractHTTPHandler()
1136 h = urllib.request.HTTPErrorProcessor()
1162 h = urllib.request.HTTPCookieProcessor(cj)
1180 h = urllib.request.HTTPRedirectHandler()
1224 # Note that the *original* request shares the same record of
1237 self.assertEqual(count, urllib.request.HTTPRedirectHandler.max_repeats)
1249 urllib.request.HTTPRedirectHandler.max_redirections)
1256 h = urllib.request.HTTPRedirectHandler()
1276 h = urllib.request.HTTPRedirectHandler()
1294 hdeh = urllib.request.HTTPDefaultErrorHandler()
1295 hrh = urllib.request.HTTPRedirectHandler()
1296 cp = urllib.request.HTTPCookieProcessor(cj)
1304 hdeh = urllib.request.HTTPDefaultErrorHandler()
1305 hrh = urllib.request.HTTPRedirectHandler()
1314 self.addCleanup(urllib.request.urlcleanup)
1321 def request(conn, method, url, *pos, **kw):
1323 real_class.request(conn, method, url, *pos, **kw)
1326 http.client.HTTPConnection.request = request
1327 fp = urllib.request.urlopen("http://python.org/path")
1333 class Handler(urllib.request.HTTPHandler):
1337 # Set up a normal response for the next request
1346 opener = urllib.request.build_opener(handler)
1362 request = handler.last_buf
1363 self.assertTrue(request.startswith(expected), repr(request))
1369 ph = urllib.request.ProxyHandler(d)
1386 ph = urllib.request.ProxyHandler(dict(http="proxy.example.com"))
1401 ph = urllib.request.ProxyHandler(dict(http="proxy.example.com"))
1411 ph = urllib.request.ProxyHandler(dict(https="proxy.example.com:3128"))
1427 ph = urllib.request.ProxyHandler(dict(https='proxy.example.com:3128'))
1437 # Verify Proxy-Authorization gets tunneled to request.
1486 auth_handler = urllib.request.HTTPBasicAuthHandler(password_manager)
1543 ph = urllib.request.ProxyHandler(dict(http="proxy.example.com:3128"))
1546 auth_handler = urllib.request.ProxyBasicAuthHandler(password_manager)
1575 class TestDigestAuthHandler(urllib.request.HTTPDigestAuthHandler):
1578 urllib.request.HTTPDigestAuthHandler.http_error_401(self,
1581 class TestBasicAuthHandler(urllib.request.HTTPBasicAuthHandler):
1584 urllib.request.HTTPBasicAuthHandler.http_error_401(self,
1611 digest_auth_handler = urllib.request.HTTPDigestAuthHandler(None)
1621 basic_auth_handler = urllib.request.HTTPBasicAuthHandler(None)
1647 # expect one request without authorization, then one with
1689 # expect request to be sent with auth header
1726 # Next request sends header in the first request
1729 # expect request to be sent with auth header
1741 handler = urllib.request.AbstractHTTPHandler()
1752 handler = urllib.request.AbstractHTTPHandler()
1767 class MyHTTPHandler(urllib.request.HTTPHandler):
1770 class FooHandler(urllib.request.BaseHandler):
1774 class BarHandler(urllib.request.BaseHandler):
1778 build_opener = urllib.request.build_opener
1796 self.opener_has_handler(o, urllib.request.HTTPHandler)
1797 o = build_opener(urllib.request.HTTPHandler)
1798 self.opener_has_handler(o, urllib.request.HTTPHandler)
1799 o = build_opener(urllib.request.HTTPHandler())
1800 self.opener_has_handler(o, urllib.request.HTTPHandler)
1803 class MyOtherHTTPHandler(urllib.request.HTTPHandler):