diff --git a/docs/advanced/ssl.md b/docs/advanced/ssl.md index 3813293f..b62c3314 100644 --- a/docs/advanced/ssl.md +++ b/docs/advanced/ssl.md @@ -46,7 +46,7 @@ ctx = truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT) client = httpx.Client(verify=ctx) ``` -Loding an alternative certificate verification store using [the standard SSL context API](https://docs.python.org/3/library/ssl.html)... +Loading an alternative certificate verification store using [the standard SSL context API](https://docs.python.org/3/library/ssl.html)... ```python import httpx diff --git a/pyproject.toml b/pyproject.toml index c6dfe351..573c2cfe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,7 +77,7 @@ filterwarnings = [ "ignore: trio.MultiError is deprecated since Trio 0.22.0:trio.TrioDeprecationWarning", ] markers = [ - "copied_from(source, changes=None): mark test as copied from somewhere else, along with a description of changes made to accodomate e.g. our test setup", + "copied_from(source, changes=None): mark test as copied from somewhere else, along with a description of changes made to accommodate e.g. our test setup", "network: marks tests which require network connection. Used in 3rd-party build environments that have network disabled.", "benchmark: marks CodSpeed benchmark tests under tests/test_benchmark.py.", ] diff --git a/src/httpcore2/CHANGELOG.md b/src/httpcore2/CHANGELOG.md index 3edd47d7..23a66587 100644 --- a/src/httpcore2/CHANGELOG.md +++ b/src/httpcore2/CHANGELOG.md @@ -64,7 +64,7 @@ Historical entries below are from upstream `encode/httpcore`. ## 1.0.5 (March 27th, 2024) - Handle `EndOfStream` exception for anyio backend. (#899) -- Allow trio `0.25.*` series in package dependancies. (#903) +- Allow trio `0.25.*` series in package dependencies. (#903) ## 1.0.4 (February 21st, 2024) @@ -142,7 +142,7 @@ The project versioning policy is now explicitly governed by SEMVER. See https:// - Allow `ws` and `wss` schemes. Allows us to properly support websocket upgrade connections. (#625) - Forwarding HTTP proxies use a connection-per-remote-host. Required by some proxy implementations. (#637) - Don't raise `RuntimeError` when closing a connection pool with active connections. Removes some error cases when cancellations are used. (#631) -- Lazy import `anyio`, so that it's no longer a hard dependancy, and isn't imported if unused. (#639) +- Lazy import `anyio`, so that it's no longer a hard dependency, and isn't imported if unused. (#639) ## 0.16.2 (November 25th, 2022) @@ -200,7 +200,7 @@ The project versioning policy is now explicitly governed by SEMVER. See https:// ## 0.14.1 (November 12th, 2021) - `max_connections` becomes optional. (Pull #429) -- `certifi` is now included in the install dependancies. (Pull #428) +- `certifi` is now included in the install dependencies. (Pull #428) - `h2` is now strictly optional. (Pull #428) ## 0.14.0 (November 11th, 2021) @@ -265,7 +265,7 @@ Note that `curio` support is not currently available in 0.14.0. If you're using ### Fixed -- More resiliant testing for closed connections. (Pull #311) +- More resilient testing for closed connections. (Pull #311) - Don't raise exceptions on ungraceful connection closes. (Pull #310) ## 0.13.0 (April 21st, 2021) diff --git a/src/httpcore2/docs/proxies.md b/src/httpcore2/docs/proxies.md index 7d4b34f9..492ea86f 100644 --- a/src/httpcore2/docs/proxies.md +++ b/src/httpcore2/docs/proxies.md @@ -88,7 +88,7 @@ If you use proxies, keep in mind that the `httpcore` package only supports proxi The `httpcore` package also supports proxies using the SOCKS5 protocol. -Make sure to install the optional dependancy using `pip install 'httpcore[socks]'`. +Make sure to install the optional dependency using `pip install 'httpcore[socks]'`. The `SOCKSProxy` class should be using instead of a standard connection pool: diff --git a/src/httpcore2/httpcore2/_async/connection_pool.py b/src/httpcore2/httpcore2/_async/connection_pool.py index bf10e28a..b0df818c 100644 --- a/src/httpcore2/httpcore2/_async/connection_pool.py +++ b/src/httpcore2/httpcore2/_async/connection_pool.py @@ -259,7 +259,7 @@ def _assign_requests_to_connections(self) -> list[AsyncConnectionInterface]: Called whenever a new request is added or removed from the pool. Any closing connections are returned, allowing the I/O for closing - those connections to be handled seperately. + those connections to be handled separately. """ closing_connections = [] diff --git a/src/httpcore2/httpcore2/_async/http11.py b/src/httpcore2/httpcore2/_async/http11.py index d774a8fc..9af11938 100644 --- a/src/httpcore2/httpcore2/_async/http11.py +++ b/src/httpcore2/httpcore2/_async/http11.py @@ -85,9 +85,9 @@ async def handle_async_request(self, request: Request) -> Response: await self._send_request_body(**kwargs) except WriteError: # If we get a write error while we're writing the request, - # then we supress this error and move on to attempting to + # then we suppress this error and move on to attempting to # read the response. Servers can sometimes close the request - # pre-emptively and then respond with a well formed HTTP + # preemptively and then respond with a well formed HTTP # error response. pass diff --git a/src/httpcore2/httpcore2/_models.py b/src/httpcore2/httpcore2/_models.py index fa611af6..29590aba 100644 --- a/src/httpcore2/httpcore2/_models.py +++ b/src/httpcore2/httpcore2/_models.py @@ -57,7 +57,7 @@ def enforce_headers( value: HeadersAsMapping | HeadersAsSequence | None = None, *, name: str ) -> list[tuple[bytes, bytes]]: """ - Convienence function that ensure all items in request or response headers + Convenience function that ensure all items in request or response headers are either bytes or strings in the plain ASCII range. """ if value is None: @@ -180,13 +180,13 @@ class URL: """ Represents the URL against which an HTTP request may be made. - The URL may either be specified as a plain string, for convienence: + The URL may either be specified as a plain string, for convenience: ```python url = httpcore2.URL("https://www.example.com/") ``` - Or be constructed with explicitily pre-parsed components: + Or be constructed with explicitly pre-parsed components: ```python url = httpcore2.URL(scheme=b'https', host=b'www.example.com', port=None, target=b'/') diff --git a/src/httpcore2/httpcore2/_sync/connection_pool.py b/src/httpcore2/httpcore2/_sync/connection_pool.py index 17fc9ae6..78003f4d 100644 --- a/src/httpcore2/httpcore2/_sync/connection_pool.py +++ b/src/httpcore2/httpcore2/_sync/connection_pool.py @@ -259,7 +259,7 @@ def _assign_requests_to_connections(self) -> list[ConnectionInterface]: Called whenever a new request is added or removed from the pool. Any closing connections are returned, allowing the I/O for closing - those connections to be handled seperately. + those connections to be handled separately. """ closing_connections = [] diff --git a/src/httpcore2/httpcore2/_sync/http11.py b/src/httpcore2/httpcore2/_sync/http11.py index 39554924..e7afdee6 100644 --- a/src/httpcore2/httpcore2/_sync/http11.py +++ b/src/httpcore2/httpcore2/_sync/http11.py @@ -85,9 +85,9 @@ def handle_request(self, request: Request) -> Response: self._send_request_body(**kwargs) except WriteError: # If we get a write error while we're writing the request, - # then we supress this error and move on to attempting to + # then we suppress this error and move on to attempting to # read the response. Servers can sometimes close the request - # pre-emptively and then respond with a well formed HTTP + # preemptively and then respond with a well formed HTTP # error response. pass diff --git a/src/httpcore2/httpcore2/_synchronization.py b/src/httpcore2/httpcore2/_synchronization.py index 04f84444..8d045ae6 100644 --- a/src/httpcore2/httpcore2/_synchronization.py +++ b/src/httpcore2/httpcore2/_synchronization.py @@ -5,7 +5,7 @@ from ._exceptions import ExceptionMapping, PoolTimeout, map_exceptions -# Our async synchronization primatives use either 'anyio' or 'trio' depending +# Our async synchronization primitives use either 'anyio' or 'trio' depending # on if they're running under asyncio or trio. try: diff --git a/src/httpcore2/httpcore2/_utils.py b/src/httpcore2/httpcore2/_utils.py index 2227300c..76e2da4a 100644 --- a/src/httpcore2/httpcore2/_utils.py +++ b/src/httpcore2/httpcore2/_utils.py @@ -20,7 +20,7 @@ def is_socket_readable(sock: socket.socket | None) -> bool: """ - Return whether a socket, as identifed by its file descriptor, is readable. + Return whether a socket, as identified by its file descriptor, is readable. "A socket is readable" means that the read buffer isn't empty, i.e. that calling .recv() on it would immediately return some data. """ diff --git a/src/httpx2/CHANGELOG.md b/src/httpx2/CHANGELOG.md index 873e203a..b2bed220 100644 --- a/src/httpx2/CHANGELOG.md +++ b/src/httpx2/CHANGELOG.md @@ -57,7 +57,7 @@ Historical entries below are from upstream `encode/httpx`. ## 0.28.0 (28th November, 2024) -Be aware that the default *JSON request bodies now use a more compact representation*. This is generally considered a prefered style, tho may require updates to test suites. +Be aware that the default *JSON request bodies now use a more compact representation*. This is generally considered a preferred style, tho may require updates to test suites. The 0.28 release includes a limited set of deprecations... @@ -192,7 +192,7 @@ Our revised [SSL documentation](docs/advanced/ssl.md) covers how to implement th ### Removed -* The `rfc3986` dependancy has been removed. (#2252) +* The `rfc3986` dependency has been removed. (#2252) ## 0.23.3 (4th January, 2023) diff --git a/src/httpx2/httpx2/_multipart.py b/src/httpx2/httpx2/_multipart.py index 7b28fc0b..b8b7d0ff 100644 --- a/src/httpx2/httpx2/_multipart.py +++ b/src/httpx2/httpx2/_multipart.py @@ -117,7 +117,7 @@ def __init__(self, name: str, value: FileTypes) -> None: # This large tuple based API largely mirror's requests' API # It would be good to think of better APIs for this that we could # include in httpx 2.0 since variable length tuples(especially of 4 elements) - # are quite unwieldly + # are quite unwieldy if isinstance(value, tuple): if len(value) == 2: # neither the 3rd parameter (content_type) nor the 4th (headers) diff --git a/src/httpx2/httpx2/_urlparse.py b/src/httpx2/httpx2/_urlparse.py index 9f08d4e1..1f79cc47 100644 --- a/src/httpx2/httpx2/_urlparse.py +++ b/src/httpx2/httpx2/_urlparse.py @@ -236,8 +236,8 @@ def urlparse(url: str = "", **kwargs: str | None) -> ParseResult: # Replace "raw_path" with "path" and "query". if "raw_path" in kwargs: raw_path = kwargs.pop("raw_path") or "" - kwargs["path"], seperator, kwargs["query"] = raw_path.partition("?") - if not seperator: + kwargs["path"], separator, kwargs["query"] = raw_path.partition("?") + if not separator: kwargs["query"] = None # Ensure that IPv6 "host" addresses are always escaped with "[...]". diff --git a/tests/httpcore2/_async/test_connection_pool.py b/tests/httpcore2/_async/test_connection_pool.py index 33eedbb6..00128241 100644 --- a/tests/httpcore2/_async/test_connection_pool.py +++ b/tests/httpcore2/_async/test_connection_pool.py @@ -30,7 +30,7 @@ async def test_connection_pool_with_keepalive(): ) async with httpcore2.AsyncConnectionPool(network_backend=network_backend, max_keepalive_connections=1) as pool: - # Sending an intial request, which once complete will return to the pool, IDLE. + # Sending an initial request, which once complete will return to the pool, IDLE. async with pool.stream("GET", "https://example.com/") as response: info = [repr(c) for c in pool.connections] assert info == [""] @@ -99,7 +99,7 @@ async def test_connection_pool_with_close(): ) async with httpcore2.AsyncConnectionPool(network_backend=network_backend) as pool: - # Sending an intial request, which once complete will not return to the pool. + # Sending an initial request, which once complete will not return to the pool. async with pool.stream("GET", "https://example.com/", headers={"Connection": "close"}) as response: info = [repr(c) for c in pool.connections] assert info == [""] @@ -148,7 +148,7 @@ async def test_connection_pool_with_http2(): async with httpcore2.AsyncConnectionPool( network_backend=network_backend, ) as pool: - # Sending an intial request, which once complete will return to the pool, IDLE. + # Sending an initial request, which once complete will return to the pool, IDLE. response = await pool.request("GET", "https://example.com/") assert response.status == 200 assert response.content == b"Hello, world!" @@ -194,7 +194,7 @@ async def test_connection_pool_with_http2_goaway(): async with httpcore2.AsyncConnectionPool( network_backend=network_backend, ) as pool: - # Sending an intial request, which once complete will return to the pool, IDLE. + # Sending an initial request, which once complete will return to the pool, IDLE. response = await pool.request("GET", "https://example.com/") assert response.status == 200 assert response.content == b"Hello, world!" @@ -420,7 +420,7 @@ async def test_connection_pool_with_immediate_expiry(): keepalive_expiry=0.0, network_backend=network_backend, ) as pool: - # Sending an intial request, which once complete will not return to the pool. + # Sending an initial request, which once complete will not return to the pool. async with pool.stream("GET", "https://example.com/") as response: info = [repr(c) for c in pool.connections] assert info == [""] @@ -449,7 +449,7 @@ async def test_connection_pool_with_no_keepalive_connections_allowed(): ) async with httpcore2.AsyncConnectionPool(max_keepalive_connections=0, network_backend=network_backend) as pool: - # Sending an intial request, which once complete will not return to the pool. + # Sending an initial request, which once complete will not return to the pool. async with pool.stream("GET", "https://example.com/") as response: info = [repr(c) for c in pool.connections] assert info == [""] diff --git a/tests/httpcore2/_async/test_http_proxy.py b/tests/httpcore2/_async/test_http_proxy.py index 37d83dab..b268cbcc 100644 --- a/tests/httpcore2/_async/test_http_proxy.py +++ b/tests/httpcore2/_async/test_http_proxy.py @@ -37,7 +37,7 @@ async def test_proxy_forwarding(): max_connections=10, network_backend=network_backend, ) as proxy: - # Sending an intial request, which once complete will return to the pool, IDLE. + # Sending an initial request, which once complete will return to the pool, IDLE. async with proxy.stream("GET", "http://example.com/") as response: info = [repr(c) for c in proxy.connections] assert info == [ @@ -82,7 +82,7 @@ async def test_proxy_tunneling(): proxy=Proxy("http://localhost:8080/"), network_backend=network_backend, ) as proxy: - # Sending an intial request, which once complete will return to the pool, IDLE. + # Sending an initial request, which once complete will return to the pool, IDLE. async with proxy.stream("GET", "https://example.com/") as response: info = [repr(c) for c in proxy.connections] assert info == [ @@ -162,7 +162,7 @@ async def test_proxy_tunneling_http2(): network_backend=network_backend, http2=True, ) as proxy: - # Sending an intial request, which once complete will return to the pool, IDLE. + # Sending an initial request, which once complete will return to the pool, IDLE. async with proxy.stream("GET", "https://example.com/") as response: info = [repr(c) for c in proxy.connections] assert info == [""] diff --git a/tests/httpcore2/_async/test_socks_proxy.py b/tests/httpcore2/_async/test_socks_proxy.py index ace6f0b0..7eba7cbb 100644 --- a/tests/httpcore2/_async/test_socks_proxy.py +++ b/tests/httpcore2/_async/test_socks_proxy.py @@ -28,7 +28,7 @@ async def test_socks5_request(): proxy=httpcore2.Proxy("socks5://localhost:8080/"), network_backend=network_backend, ) as proxy: - # Sending an intial request, which once complete will return to the pool, IDLE. + # Sending an initial request, which once complete will return to the pool, IDLE. async with proxy.stream("GET", "https://example.com/") as response: info = [repr(c) for c in proxy.connections] assert info == [""] @@ -79,7 +79,7 @@ async def test_authenticated_socks5_request(): ), network_backend=network_backend, ) as proxy: - # Sending an intial request, which once complete will return to the pool, IDLE. + # Sending an initial request, which once complete will return to the pool, IDLE. async with proxy.stream("GET", "https://example.com/") as response: info = [repr(c) for c in proxy.connections] assert info == [""] @@ -152,7 +152,7 @@ async def test_socks5_request_failed_to_provide_auth(): async def test_socks5_request_incorrect_auth(): """ Attempt to send an HTTP request via an authenticated SOCKS proxy, - wit incorrect authentication credentials. + with incorrect authentication credentials. """ network_backend = httpcore2.AsyncMockBackend( [ diff --git a/tests/httpcore2/_sync/test_connection_pool.py b/tests/httpcore2/_sync/test_connection_pool.py index 00dcb232..3aa2f5a7 100644 --- a/tests/httpcore2/_sync/test_connection_pool.py +++ b/tests/httpcore2/_sync/test_connection_pool.py @@ -30,7 +30,7 @@ def test_connection_pool_with_keepalive(): ) with httpcore2.ConnectionPool(network_backend=network_backend, max_keepalive_connections=1) as pool: - # Sending an intial request, which once complete will return to the pool, IDLE. + # Sending an initial request, which once complete will return to the pool, IDLE. with pool.stream("GET", "https://example.com/") as response: info = [repr(c) for c in pool.connections] assert info == [""] @@ -99,7 +99,7 @@ def test_connection_pool_with_close(): ) with httpcore2.ConnectionPool(network_backend=network_backend) as pool: - # Sending an intial request, which once complete will not return to the pool. + # Sending an initial request, which once complete will not return to the pool. with pool.stream("GET", "https://example.com/", headers={"Connection": "close"}) as response: info = [repr(c) for c in pool.connections] assert info == [""] @@ -148,7 +148,7 @@ def test_connection_pool_with_http2(): with httpcore2.ConnectionPool( network_backend=network_backend, ) as pool: - # Sending an intial request, which once complete will return to the pool, IDLE. + # Sending an initial request, which once complete will return to the pool, IDLE. response = pool.request("GET", "https://example.com/") assert response.status == 200 assert response.content == b"Hello, world!" @@ -194,7 +194,7 @@ def test_connection_pool_with_http2_goaway(): with httpcore2.ConnectionPool( network_backend=network_backend, ) as pool: - # Sending an intial request, which once complete will return to the pool, IDLE. + # Sending an initial request, which once complete will return to the pool, IDLE. response = pool.request("GET", "https://example.com/") assert response.status == 200 assert response.content == b"Hello, world!" @@ -420,7 +420,7 @@ def test_connection_pool_with_immediate_expiry(): keepalive_expiry=0.0, network_backend=network_backend, ) as pool: - # Sending an intial request, which once complete will not return to the pool. + # Sending an initial request, which once complete will not return to the pool. with pool.stream("GET", "https://example.com/") as response: info = [repr(c) for c in pool.connections] assert info == [""] @@ -449,7 +449,7 @@ def test_connection_pool_with_no_keepalive_connections_allowed(): ) with httpcore2.ConnectionPool(max_keepalive_connections=0, network_backend=network_backend) as pool: - # Sending an intial request, which once complete will not return to the pool. + # Sending an initial request, which once complete will not return to the pool. with pool.stream("GET", "https://example.com/") as response: info = [repr(c) for c in pool.connections] assert info == [""] diff --git a/tests/httpcore2/_sync/test_http_proxy.py b/tests/httpcore2/_sync/test_http_proxy.py index feff9ac6..ed17b832 100644 --- a/tests/httpcore2/_sync/test_http_proxy.py +++ b/tests/httpcore2/_sync/test_http_proxy.py @@ -37,7 +37,7 @@ def test_proxy_forwarding(): max_connections=10, network_backend=network_backend, ) as proxy: - # Sending an intial request, which once complete will return to the pool, IDLE. + # Sending an initial request, which once complete will return to the pool, IDLE. with proxy.stream("GET", "http://example.com/") as response: info = [repr(c) for c in proxy.connections] assert info == [ @@ -82,7 +82,7 @@ def test_proxy_tunneling(): proxy=Proxy("http://localhost:8080/"), network_backend=network_backend, ) as proxy: - # Sending an intial request, which once complete will return to the pool, IDLE. + # Sending an initial request, which once complete will return to the pool, IDLE. with proxy.stream("GET", "https://example.com/") as response: info = [repr(c) for c in proxy.connections] assert info == [ @@ -162,7 +162,7 @@ def test_proxy_tunneling_http2(): network_backend=network_backend, http2=True, ) as proxy: - # Sending an intial request, which once complete will return to the pool, IDLE. + # Sending an initial request, which once complete will return to the pool, IDLE. with proxy.stream("GET", "https://example.com/") as response: info = [repr(c) for c in proxy.connections] assert info == [""] diff --git a/tests/httpcore2/_sync/test_socks_proxy.py b/tests/httpcore2/_sync/test_socks_proxy.py index 9ca4a725..72369d0e 100644 --- a/tests/httpcore2/_sync/test_socks_proxy.py +++ b/tests/httpcore2/_sync/test_socks_proxy.py @@ -28,7 +28,7 @@ def test_socks5_request(): proxy=httpcore2.Proxy("socks5://localhost:8080/"), network_backend=network_backend, ) as proxy: - # Sending an intial request, which once complete will return to the pool, IDLE. + # Sending an initial request, which once complete will return to the pool, IDLE. with proxy.stream("GET", "https://example.com/") as response: info = [repr(c) for c in proxy.connections] assert info == [""] @@ -79,7 +79,7 @@ def test_authenticated_socks5_request(): ), network_backend=network_backend, ) as proxy: - # Sending an intial request, which once complete will return to the pool, IDLE. + # Sending an initial request, which once complete will return to the pool, IDLE. with proxy.stream("GET", "https://example.com/") as response: info = [repr(c) for c in proxy.connections] assert info == [""] @@ -152,7 +152,7 @@ def test_socks5_request_failed_to_provide_auth(): def test_socks5_request_incorrect_auth(): """ Attempt to send an HTTP request via an authenticated SOCKS proxy, - wit incorrect authentication credentials. + with incorrect authentication credentials. """ network_backend = httpcore2.MockBackend( [ diff --git a/tests/httpcore2/concurrency.py b/tests/httpcore2/concurrency.py index a0572d53..0962846b 100644 --- a/tests/httpcore2/concurrency.py +++ b/tests/httpcore2/concurrency.py @@ -6,7 +6,7 @@ but in a plain old multi-threaded context. We don't do any smarts around cancellations, or managing exceptions from -childen, because we don't need that for our use-case. +children, because we don't need that for our use-case. """ import threading diff --git a/tests/httpx2/models/test_url.py b/tests/httpx2/models/test_url.py index 90449cf0..856c6523 100644 --- a/tests/httpx2/models/test_url.py +++ b/tests/httpx2/models/test_url.py @@ -281,7 +281,7 @@ def test_url_leading_dot_prefix_on_relative_url(): def test_param_with_space(): # Params passed as form key-value pairs should be form escaped, - # Including the special case of "+" for space seperators. + # Including the special case of "+" for space separators. url = httpx2.URL("http://webservice", params={"u": "with spaces"}) assert str(url) == "http://webservice?u=with+spaces"