@@ -138,19 +138,36 @@ def __init__(
138138 retries = retries ,
139139 )
140140 else :
141- self ._pool = httpcore .HTTPProxy (
142- proxy_url = httpcore .URL (
143- scheme = proxy .url .raw_scheme ,
144- host = proxy .url .raw_host ,
145- port = proxy .url .port ,
146- target = proxy .url .raw_path ,
147- ),
148- proxy_headers = proxy .headers .raw ,
149- ssl_context = ssl_context ,
150- max_connections = limits .max_connections ,
151- max_keepalive_connections = limits .max_keepalive_connections ,
152- keepalive_expiry = limits .keepalive_expiry ,
153- )
141+ try :
142+ self ._pool = httpcore .HTTPProxy (
143+ proxy_url = httpcore .URL (
144+ scheme = proxy .url .raw_scheme ,
145+ host = proxy .url .raw_host ,
146+ port = proxy .url .port ,
147+ target = proxy .url .raw_path ,
148+ ),
149+ proxy_headers = proxy .headers .raw ,
150+ ssl_context = ssl_context ,
151+ max_connections = limits .max_connections ,
152+ max_keepalive_connections = limits .max_keepalive_connections ,
153+ keepalive_expiry = limits .keepalive_expiry ,
154+ http1 = http1 ,
155+ http2 = http2 ,
156+ )
157+ except TypeError : # pragma: nocover
158+ self ._pool = httpcore .HTTPProxy (
159+ proxy_url = httpcore .URL (
160+ scheme = proxy .url .raw_scheme ,
161+ host = proxy .url .raw_host ,
162+ port = proxy .url .port ,
163+ target = proxy .url .raw_path ,
164+ ),
165+ proxy_headers = proxy .headers .raw ,
166+ ssl_context = ssl_context ,
167+ max_connections = limits .max_connections ,
168+ max_keepalive_connections = limits .max_keepalive_connections ,
169+ keepalive_expiry = limits .keepalive_expiry ,
170+ )
154171
155172 def __enter__ (self : T ) -> T : # Use generics for subclass support.
156173 self ._pool .__enter__ ()
0 commit comments