Compare commits
2 Commits
master
...
add-socket
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f88fa846d9 | ||
|
|
2f737cadc1 |
@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
* Add `socket_options` to `Client` and `AsyncClient` classes. (#3587)
|
||||||
|
|
||||||
## 0.28.1 (6th December, 2024)
|
## 0.28.1 (6th December, 2024)
|
||||||
|
|
||||||
* Fix SSL case where `verify=False` together with client side certificates.
|
* Fix SSL case where `verify=False` together with client side certificates.
|
||||||
|
|||||||
@ -29,7 +29,7 @@ from ._exceptions import (
|
|||||||
from ._models import Cookies, Headers, Request, Response
|
from ._models import Cookies, Headers, Request, Response
|
||||||
from ._status_codes import codes
|
from ._status_codes import codes
|
||||||
from ._transports.base import AsyncBaseTransport, BaseTransport
|
from ._transports.base import AsyncBaseTransport, BaseTransport
|
||||||
from ._transports.default import AsyncHTTPTransport, HTTPTransport
|
from ._transports.default import SOCKET_OPTION, AsyncHTTPTransport, HTTPTransport
|
||||||
from ._types import (
|
from ._types import (
|
||||||
AsyncByteStream,
|
AsyncByteStream,
|
||||||
AuthTypes,
|
AuthTypes,
|
||||||
@ -653,6 +653,7 @@ class Client(BaseClient):
|
|||||||
timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,
|
timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,
|
||||||
follow_redirects: bool = False,
|
follow_redirects: bool = False,
|
||||||
limits: Limits = DEFAULT_LIMITS,
|
limits: Limits = DEFAULT_LIMITS,
|
||||||
|
socket_options: typing.Iterable[SOCKET_OPTION] | None = None,
|
||||||
max_redirects: int = DEFAULT_MAX_REDIRECTS,
|
max_redirects: int = DEFAULT_MAX_REDIRECTS,
|
||||||
event_hooks: None | (typing.Mapping[str, list[EventHook]]) = None,
|
event_hooks: None | (typing.Mapping[str, list[EventHook]]) = None,
|
||||||
base_url: URL | str = "",
|
base_url: URL | str = "",
|
||||||
@ -693,6 +694,7 @@ class Client(BaseClient):
|
|||||||
http2=http2,
|
http2=http2,
|
||||||
limits=limits,
|
limits=limits,
|
||||||
transport=transport,
|
transport=transport,
|
||||||
|
socket_options=socket_options,
|
||||||
)
|
)
|
||||||
self._mounts: dict[URLPattern, BaseTransport | None] = {
|
self._mounts: dict[URLPattern, BaseTransport | None] = {
|
||||||
URLPattern(key): None
|
URLPattern(key): None
|
||||||
@ -705,6 +707,7 @@ class Client(BaseClient):
|
|||||||
http1=http1,
|
http1=http1,
|
||||||
http2=http2,
|
http2=http2,
|
||||||
limits=limits,
|
limits=limits,
|
||||||
|
socket_options=socket_options,
|
||||||
)
|
)
|
||||||
for key, proxy in proxy_map.items()
|
for key, proxy in proxy_map.items()
|
||||||
}
|
}
|
||||||
@ -723,6 +726,7 @@ class Client(BaseClient):
|
|||||||
http1: bool = True,
|
http1: bool = True,
|
||||||
http2: bool = False,
|
http2: bool = False,
|
||||||
limits: Limits = DEFAULT_LIMITS,
|
limits: Limits = DEFAULT_LIMITS,
|
||||||
|
socket_options: typing.Iterable[SOCKET_OPTION] | None = None,
|
||||||
transport: BaseTransport | None = None,
|
transport: BaseTransport | None = None,
|
||||||
) -> BaseTransport:
|
) -> BaseTransport:
|
||||||
if transport is not None:
|
if transport is not None:
|
||||||
@ -735,6 +739,7 @@ class Client(BaseClient):
|
|||||||
http1=http1,
|
http1=http1,
|
||||||
http2=http2,
|
http2=http2,
|
||||||
limits=limits,
|
limits=limits,
|
||||||
|
socket_options=socket_options,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _init_proxy_transport(
|
def _init_proxy_transport(
|
||||||
@ -746,6 +751,7 @@ class Client(BaseClient):
|
|||||||
http1: bool = True,
|
http1: bool = True,
|
||||||
http2: bool = False,
|
http2: bool = False,
|
||||||
limits: Limits = DEFAULT_LIMITS,
|
limits: Limits = DEFAULT_LIMITS,
|
||||||
|
socket_options: typing.Iterable[SOCKET_OPTION] | None = None,
|
||||||
) -> BaseTransport:
|
) -> BaseTransport:
|
||||||
return HTTPTransport(
|
return HTTPTransport(
|
||||||
verify=verify,
|
verify=verify,
|
||||||
@ -755,6 +761,7 @@ class Client(BaseClient):
|
|||||||
http2=http2,
|
http2=http2,
|
||||||
limits=limits,
|
limits=limits,
|
||||||
proxy=proxy,
|
proxy=proxy,
|
||||||
|
socket_options=socket_options,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _transport_for_url(self, url: URL) -> BaseTransport:
|
def _transport_for_url(self, url: URL) -> BaseTransport:
|
||||||
@ -1366,6 +1373,7 @@ class AsyncClient(BaseClient):
|
|||||||
timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,
|
timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,
|
||||||
follow_redirects: bool = False,
|
follow_redirects: bool = False,
|
||||||
limits: Limits = DEFAULT_LIMITS,
|
limits: Limits = DEFAULT_LIMITS,
|
||||||
|
socket_options: typing.Iterable[SOCKET_OPTION] | None = None,
|
||||||
max_redirects: int = DEFAULT_MAX_REDIRECTS,
|
max_redirects: int = DEFAULT_MAX_REDIRECTS,
|
||||||
event_hooks: None | (typing.Mapping[str, list[EventHook]]) = None,
|
event_hooks: None | (typing.Mapping[str, list[EventHook]]) = None,
|
||||||
base_url: URL | str = "",
|
base_url: URL | str = "",
|
||||||
@ -1407,6 +1415,7 @@ class AsyncClient(BaseClient):
|
|||||||
http2=http2,
|
http2=http2,
|
||||||
limits=limits,
|
limits=limits,
|
||||||
transport=transport,
|
transport=transport,
|
||||||
|
socket_options=socket_options,
|
||||||
)
|
)
|
||||||
|
|
||||||
self._mounts: dict[URLPattern, AsyncBaseTransport | None] = {
|
self._mounts: dict[URLPattern, AsyncBaseTransport | None] = {
|
||||||
@ -1420,6 +1429,7 @@ class AsyncClient(BaseClient):
|
|||||||
http1=http1,
|
http1=http1,
|
||||||
http2=http2,
|
http2=http2,
|
||||||
limits=limits,
|
limits=limits,
|
||||||
|
socket_options=socket_options,
|
||||||
)
|
)
|
||||||
for key, proxy in proxy_map.items()
|
for key, proxy in proxy_map.items()
|
||||||
}
|
}
|
||||||
@ -1437,6 +1447,7 @@ class AsyncClient(BaseClient):
|
|||||||
http1: bool = True,
|
http1: bool = True,
|
||||||
http2: bool = False,
|
http2: bool = False,
|
||||||
limits: Limits = DEFAULT_LIMITS,
|
limits: Limits = DEFAULT_LIMITS,
|
||||||
|
socket_options: typing.Iterable[SOCKET_OPTION] | None = None,
|
||||||
transport: AsyncBaseTransport | None = None,
|
transport: AsyncBaseTransport | None = None,
|
||||||
) -> AsyncBaseTransport:
|
) -> AsyncBaseTransport:
|
||||||
if transport is not None:
|
if transport is not None:
|
||||||
@ -1449,6 +1460,7 @@ class AsyncClient(BaseClient):
|
|||||||
http1=http1,
|
http1=http1,
|
||||||
http2=http2,
|
http2=http2,
|
||||||
limits=limits,
|
limits=limits,
|
||||||
|
socket_options=socket_options,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _init_proxy_transport(
|
def _init_proxy_transport(
|
||||||
@ -1460,6 +1472,7 @@ class AsyncClient(BaseClient):
|
|||||||
http1: bool = True,
|
http1: bool = True,
|
||||||
http2: bool = False,
|
http2: bool = False,
|
||||||
limits: Limits = DEFAULT_LIMITS,
|
limits: Limits = DEFAULT_LIMITS,
|
||||||
|
socket_options: typing.Iterable[SOCKET_OPTION] | None = None,
|
||||||
) -> AsyncBaseTransport:
|
) -> AsyncBaseTransport:
|
||||||
return AsyncHTTPTransport(
|
return AsyncHTTPTransport(
|
||||||
verify=verify,
|
verify=verify,
|
||||||
@ -1469,6 +1482,7 @@ class AsyncClient(BaseClient):
|
|||||||
http2=http2,
|
http2=http2,
|
||||||
limits=limits,
|
limits=limits,
|
||||||
proxy=proxy,
|
proxy=proxy,
|
||||||
|
socket_options=socket_options,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _transport_for_url(self, url: URL) -> AsyncBaseTransport:
|
def _transport_for_url(self, url: URL) -> AsyncBaseTransport:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user