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:
Tom Christie 2020-05-21 13:21:43 +01:00 committed by GitHub
parent d2816c9c48
commit 9b6605c3d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 8 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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"),

View File

@ -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,

View File

@ -61,7 +61,7 @@ setup(
"chardet==3.*",
"idna==2.*",
"rfc3986>=1.3,<2",
"httpcore>=0.8.4",
"httpcore==0.9.*",
],
classifiers=[
"Development Status :: 4 - Beta",