Updates for httpcore 0.9 interface. (#967)
* Pass proxy_url * Update httpcore dependancy * Update port in Transport API to be 'Optional[int]'
This commit is contained in:
parent
d2816c9c48
commit
9b6605c3d5
@ -528,7 +528,7 @@ class Client(BaseClient):
|
||||
max_connections = pool_limits.hard_limit
|
||||
|
||||
return httpcore.SyncHTTPProxy(
|
||||
proxy_origin=proxy.url.raw[:3],
|
||||
proxy_url=proxy.url.raw,
|
||||
proxy_headers=proxy.headers.raw,
|
||||
proxy_mode=proxy.mode,
|
||||
ssl_context=ssl_context,
|
||||
@ -1076,7 +1076,7 @@ class AsyncClient(BaseClient):
|
||||
max_connections = pool_limits.hard_limit
|
||||
|
||||
return httpcore.AsyncHTTPProxy(
|
||||
proxy_origin=proxy.url.raw[:3],
|
||||
proxy_url=proxy.url.raw,
|
||||
proxy_headers=proxy.headers.raw,
|
||||
proxy_mode=proxy.mode,
|
||||
ssl_context=ssl_context,
|
||||
|
||||
@ -73,7 +73,7 @@ class ASGITransport(httpcore.AsyncHTTPTransport):
|
||||
async def request(
|
||||
self,
|
||||
method: bytes,
|
||||
url: Tuple[bytes, bytes, int, bytes],
|
||||
url: Tuple[bytes, bytes, Optional[int], bytes],
|
||||
headers: List[Tuple[bytes, bytes]] = None,
|
||||
stream: httpcore.AsyncByteStream = None,
|
||||
timeout: Dict[str, Optional[float]] = None,
|
||||
|
||||
@ -88,7 +88,7 @@ class URLLib3Transport(httpcore.SyncHTTPTransport):
|
||||
def request(
|
||||
self,
|
||||
method: bytes,
|
||||
url: Tuple[bytes, bytes, int, bytes],
|
||||
url: Tuple[bytes, bytes, Optional[int], bytes],
|
||||
headers: List[Tuple[bytes, bytes]] = None,
|
||||
stream: httpcore.SyncByteStream = None,
|
||||
timeout: Dict[str, Optional[float]] = None,
|
||||
@ -112,8 +112,8 @@ class URLLib3Transport(httpcore.SyncHTTPTransport):
|
||||
body = stream if chunked or content_length else None
|
||||
|
||||
scheme, host, port, path = url
|
||||
default_scheme = {80: b"http", 443: "https"}.get(port)
|
||||
if scheme == default_scheme:
|
||||
default_port = {b"http": 80, "https": 443}.get(scheme)
|
||||
if port is None or port == default_port:
|
||||
url_str = "%s://%s%s" % (
|
||||
scheme.decode("ascii"),
|
||||
host.decode("ascii"),
|
||||
|
||||
@ -64,7 +64,7 @@ class WSGITransport(httpcore.SyncHTTPTransport):
|
||||
def request(
|
||||
self,
|
||||
method: bytes,
|
||||
url: typing.Tuple[bytes, bytes, int, bytes],
|
||||
url: typing.Tuple[bytes, bytes, typing.Optional[int], bytes],
|
||||
headers: typing.List[typing.Tuple[bytes, bytes]] = None,
|
||||
stream: httpcore.SyncByteStream = None,
|
||||
timeout: typing.Dict[str, typing.Optional[float]] = None,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user