diff --git a/docs/proxies.md b/docs/proxies.md index 970d53d5..e7802f90 100644 --- a/docs/proxies.md +++ b/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/httpcore/_async/connection_pool.py b/httpcore/_async/connection_pool.py index 5ef74e64..1139f006 100644 --- a/httpcore/_async/connection_pool.py +++ b/httpcore/_async/connection_pool.py @@ -275,7 +275,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/httpcore/_sync/connection_pool.py b/httpcore/_sync/connection_pool.py index 4b26f9c6..1b0fd697 100644 --- a/httpcore/_sync/connection_pool.py +++ b/httpcore/_sync/connection_pool.py @@ -275,7 +275,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/tests/_async/test_connection_pool.py b/tests/_async/test_connection_pool.py index bc4b251e..38fe97b9 100644 --- a/tests/_async/test_connection_pool.py +++ b/tests/_async/test_connection_pool.py @@ -32,7 +32,7 @@ async def test_connection_pool_with_keepalive(): async with httpcore.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 == [ @@ -126,7 +126,7 @@ async def test_connection_pool_with_close(): ) async with httpcore.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: @@ -183,7 +183,7 @@ async def test_connection_pool_with_http2(): async with httpcore.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!" @@ -237,7 +237,7 @@ async def test_connection_pool_with_http2_goaway(): async with httpcore.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!" @@ -471,7 +471,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 == [ @@ -504,7 +504,7 @@ async def test_connection_pool_with_no_keepalive_connections_allowed(): async with httpcore.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/_async/test_http_proxy.py b/tests/_async/test_http_proxy.py index 84a984b8..351cba69 100644 --- a/tests/_async/test_http_proxy.py +++ b/tests/_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 == [ @@ -92,7 +92,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 == [ @@ -184,7 +184,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/_async/test_socks_proxy.py b/tests/_async/test_socks_proxy.py index 907594a4..0f22d946 100644 --- a/tests/_async/test_socks_proxy.py +++ b/tests/_async/test_socks_proxy.py @@ -28,7 +28,7 @@ async def test_socks5_request(): proxy=httpcore.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 == [ @@ -91,7 +91,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 == [ @@ -171,7 +171,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 = httpcore.AsyncMockBackend( [ diff --git a/tests/_sync/test_connection_pool.py b/tests/_sync/test_connection_pool.py index 7adc3f5c..89d178a6 100644 --- a/tests/_sync/test_connection_pool.py +++ b/tests/_sync/test_connection_pool.py @@ -32,7 +32,7 @@ def test_connection_pool_with_keepalive(): with httpcore.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 == [ @@ -126,7 +126,7 @@ def test_connection_pool_with_close(): ) with httpcore.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: @@ -183,7 +183,7 @@ def test_connection_pool_with_http2(): with httpcore.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!" @@ -237,7 +237,7 @@ def test_connection_pool_with_http2_goaway(): with httpcore.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!" @@ -471,7 +471,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 == [ @@ -504,7 +504,7 @@ def test_connection_pool_with_no_keepalive_connections_allowed(): with httpcore.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/_sync/test_http_proxy.py b/tests/_sync/test_http_proxy.py index 966672dd..72147aa1 100644 --- a/tests/_sync/test_http_proxy.py +++ b/tests/_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 == [ @@ -92,7 +92,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 == [ @@ -184,7 +184,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/_sync/test_socks_proxy.py b/tests/_sync/test_socks_proxy.py index 89ec9fae..f42bd7f4 100644 --- a/tests/_sync/test_socks_proxy.py +++ b/tests/_sync/test_socks_proxy.py @@ -28,7 +28,7 @@ def test_socks5_request(): proxy=httpcore.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 == [ @@ -91,7 +91,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 == [ @@ -171,7 +171,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 = httpcore.MockBackend( [