@@ -223,23 +223,26 @@ async def request(
223223 trust_env : bool = None ,
224224 ) -> Response :
225225 if cert is not None :
226- warnings . warn (
226+ raise RuntimeError (
227227 "Passing a 'cert' argument when making a request on a client "
228- "is due to be deprecated . Instantiate a new client instead, "
228+ "is not supported anymore . Instantiate a new client instead, "
229229 "passing any 'cert' arguments to the client itself."
230230 )
231+
231232 if verify is not None :
232- warnings . warn (
233+ raise RuntimeError (
233234 "Passing a 'verify' argument when making a request on a client "
234- "is due to be deprecated . Instantiate a new client instead, "
235+ "is not supported anymore . Instantiate a new client instead, "
235236 "passing any 'verify' arguments to the client itself."
236237 )
238+
237239 if trust_env is not None :
238- warnings . warn (
240+ raise RuntimeError (
239241 "Passing a 'trust_env' argument when making a request on a client "
240- "is due to be deprecated . Instantiate a new client instead, "
242+ "is not supported anymore . Instantiate a new client instead, "
241243 "passing any 'trust_env' argument to the client itself."
242244 )
245+
243246 if stream :
244247 warnings .warn (
245248 "The 'stream=True' argument is due to be deprecated. "
@@ -261,10 +264,7 @@ async def request(
261264 stream = stream ,
262265 auth = auth ,
263266 allow_redirects = allow_redirects ,
264- verify = verify ,
265- cert = cert ,
266267 timeout = timeout ,
267- trust_env = trust_env ,
268268 )
269269 return response
270270
@@ -388,25 +388,17 @@ async def send(
388388 stream : bool = False ,
389389 auth : AuthTypes = None ,
390390 allow_redirects : bool = True ,
391- verify : VerifyTypes = None ,
392- cert : CertTypes = None ,
393391 timeout : typing .Union [TimeoutTypes , UnsetType ] = UNSET ,
394- trust_env : bool = None ,
395392 ) -> Response :
396393 if request .url .scheme not in ("http" , "https" ):
397394 raise InvalidURL ('URL scheme must be "http" or "https".' )
398395
399396 timeout = self .timeout if isinstance (timeout , UnsetType ) else Timeout (timeout )
400397
401- auth = self .setup_auth (request , trust_env , auth )
398+ auth = self .setup_auth (request , auth )
402399
403400 response = await self .send_handling_redirects (
404- request ,
405- auth = auth ,
406- verify = verify ,
407- cert = cert ,
408- timeout = timeout ,
409- allow_redirects = allow_redirects ,
401+ request , auth = auth , timeout = timeout , allow_redirects = allow_redirects ,
410402 )
411403
412404 if not stream :
@@ -417,11 +409,8 @@ async def send(
417409
418410 return response
419411
420- def setup_auth (
421- self , request : Request , trust_env : bool = None , auth : AuthTypes = None
422- ) -> Auth :
412+ def setup_auth (self , request : Request , auth : AuthTypes = None ) -> Auth :
423413 auth = self .auth if auth is None else auth
424- trust_env = self .trust_env if trust_env is None else trust_env
425414
426415 if auth is not None :
427416 if isinstance (auth , tuple ):
@@ -436,7 +425,7 @@ def setup_auth(
436425 if username or password :
437426 return BasicAuth (username = username , password = password )
438427
439- if trust_env and "Authorization" not in request .headers :
428+ if self . trust_env and "Authorization" not in request .headers :
440429 credentials = self .netrc .get_credentials (request .url .authority )
441430 if credentials is not None :
442431 return BasicAuth (username = credentials [0 ], password = credentials [1 ])
@@ -448,8 +437,6 @@ async def send_handling_redirects(
448437 request : Request ,
449438 auth : Auth ,
450439 timeout : Timeout ,
451- verify : VerifyTypes = None ,
452- cert : CertTypes = None ,
453440 allow_redirects : bool = True ,
454441 history : typing .List [Response ] = None ,
455442 ) -> Response :
@@ -463,7 +450,7 @@ async def send_handling_redirects(
463450 raise RedirectLoop ()
464451
465452 response = await self .send_handling_auth (
466- request , auth = auth , timeout = timeout , verify = verify , cert = cert
453+ request , auth = auth , timeout = timeout ,
467454 )
468455 response .history = list (history )
469456
@@ -479,8 +466,6 @@ async def send_handling_redirects(
479466 self .send_handling_redirects ,
480467 request = request ,
481468 auth = auth ,
482- verify = verify ,
483- cert = cert ,
484469 timeout = timeout ,
485470 allow_redirects = False ,
486471 history = history ,
@@ -580,17 +565,12 @@ def redirect_stream(
580565 return request .stream
581566
582567 async def send_handling_auth (
583- self ,
584- request : Request ,
585- auth : Auth ,
586- timeout : Timeout ,
587- verify : VerifyTypes = None ,
588- cert : CertTypes = None ,
568+ self , request : Request , auth : Auth , timeout : Timeout ,
589569 ) -> Response :
590570 auth_flow = auth (request )
591571 request = next (auth_flow )
592572 while True :
593- response = await self .send_single_request (request , timeout , verify , cert )
573+ response = await self .send_single_request (request , timeout )
594574 try :
595575 next_request = auth_flow .send (response )
596576 except StopIteration :
@@ -603,11 +583,7 @@ async def send_handling_auth(
603583 await response .close ()
604584
605585 async def send_single_request (
606- self ,
607- request : Request ,
608- timeout : Timeout ,
609- verify : VerifyTypes = None ,
610- cert : CertTypes = None ,
586+ self , request : Request , timeout : Timeout ,
611587 ) -> Response :
612588 """
613589 Sends a single request, without handling any redirections.
@@ -617,9 +593,7 @@ async def send_single_request(
617593
618594 try :
619595 with ElapsedTimer () as timer :
620- response = await dispatcher .send (
621- request , verify = verify , cert = cert , timeout = timeout
622- )
596+ response = await dispatcher .send (request , timeout = timeout )
623597 response .elapsed = timer .elapsed
624598 response .request = request
625599 except HTTPError as exc :
0 commit comments