]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Switch to private module names (#785)
authorFlorimond Manca <florimond.manca@gmail.com>
Tue, 28 Jan 2020 14:34:43 +0000 (15:34 +0100)
committerTom Christie <tom@tomchristie.com>
Tue, 28 Jan 2020 14:34:43 +0000 (14:34 +0000)
* Rename modules

* Update names in package

* Fix tests

* Review docs

45 files changed:
docs/environment_variables.md
httpx/__init__.py
httpx/_api.py [moved from httpx/api.py with 98% similarity]
httpx/_auth.py [moved from httpx/auth.py with 98% similarity]
httpx/_backends/__init__.py [moved from httpx/backends/__init__.py with 100% similarity]
httpx/_backends/asyncio.py [moved from httpx/backends/asyncio.py with 98% similarity]
httpx/_backends/auto.py [moved from httpx/backends/auto.py with 98% similarity]
httpx/_backends/base.py [moved from httpx/backends/base.py with 99% similarity]
httpx/_backends/trio.py [moved from httpx/backends/trio.py with 97% similarity]
httpx/_client.py [moved from httpx/client.py with 98% similarity]
httpx/_config.py [moved from httpx/config.py with 99% similarity]
httpx/_content_streams.py [moved from httpx/content_streams.py with 99% similarity]
httpx/_decoders.py [moved from httpx/decoders.py with 99% similarity]
httpx/_dispatch/__init__.py [moved from httpx/dispatch/__init__.py with 100% similarity]
httpx/_dispatch/asgi.py [moved from httpx/dispatch/asgi.py with 97% similarity]
httpx/_dispatch/base.py [moved from httpx/dispatch/base.py with 96% similarity]
httpx/_dispatch/connection.py [moved from httpx/dispatch/connection.py with 96% similarity]
httpx/_dispatch/connection_pool.py [moved from httpx/dispatch/connection_pool.py with 97% similarity]
httpx/_dispatch/http11.py [moved from httpx/dispatch/http11.py with 96% similarity]
httpx/_dispatch/http2.py [moved from httpx/dispatch/http2.py with 97% similarity]
httpx/_dispatch/proxy_http.py [moved from httpx/dispatch/proxy_http.py with 96% similarity]
httpx/_dispatch/urllib3.py [moved from httpx/dispatch/urllib3.py with 96% similarity]
httpx/_dispatch/wsgi.py [moved from httpx/dispatch/wsgi.py with 96% similarity]
httpx/_exceptions.py [moved from httpx/exceptions.py with 97% similarity]
httpx/_models.py [moved from httpx/models.py with 99% similarity]
httpx/_status_codes.py [moved from httpx/status_codes.py with 100% similarity]
httpx/_utils.py [moved from httpx/utils.py with 99% similarity]
tests/client/test_auth.py
tests/client/test_cookies.py
tests/client/test_headers.py
tests/client/test_queryparams.py
tests/client/test_redirects.py
tests/dispatch/test_connection_pools.py
tests/dispatch/test_connections.py
tests/dispatch/test_proxy_http.py
tests/dispatch/utils.py
tests/models/test_responses.py
tests/models/test_url.py
tests/test_concurrency.py
tests/test_config.py
tests/test_content_streams.py
tests/test_decoders.py
tests/test_multipart.py
tests/test_utils.py
tests/utils.py

index 123a890847fa202abdc7ff143e5703b7211b2f3a..4f74e49028840dbc9a3a752e6cc9eb924cfcfc63 100644 (file)
@@ -32,46 +32,46 @@ Debug output:
 
 ```console
 $ HTTPX_LOG_LEVEL=debug python test_script.py
-DEBUG [2019-11-06 19:11:24] httpx.client - HTTP Request: GET https://google.com "HTTP/1.1 301 Moved Permanently"
-DEBUG [2019-11-06 19:11:24] httpx.client - HTTP Request: GET https://www.google.com/ "HTTP/1.1 200 OK"
+DEBUG [2019-11-06 19:11:24] httpx._client - HTTP Request: GET https://google.com "HTTP/1.1 301 Moved Permanently"
+DEBUG [2019-11-06 19:11:24] httpx._client - HTTP Request: GET https://www.google.com/ "HTTP/1.1 200 OK"
 ```
 
 Trace output:
 
 ```console
 $ HTTPX_LOG_LEVEL=trace python test_script.py
-TRACE [2019-11-06 19:18:56] httpx.dispatch.connection_pool - acquire_connection origin=Origin(scheme='https' host='google.com' port=443)
-TRACE [2019-11-06 19:18:56] httpx.dispatch.connection_pool - new_connection connection=HTTPConnection(origin=Origin(scheme='https' host='google.com' port=443))
-TRACE [2019-11-06 19:18:56] httpx.config - load_ssl_context verify=True cert=None trust_env=True http_versions=HTTPVersionConfig(['HTTP/1.1', 'HTTP/2'])
-TRACE [2019-11-06 19:18:56] httpx.config - load_verify_locations cafile=/Users/florimond/Developer/python-projects/httpx/venv/lib/python3.8/site-packages/certifi/cacert.pem
-TRACE [2019-11-06 19:18:56] httpx.dispatch.connection - start_connect host='google.com' port=443 timeout=Timeout(timeout=5.0)
-TRACE [2019-11-06 19:18:56] httpx.dispatch.connection - connected http_version='HTTP/2'
-TRACE [2019-11-06 19:18:56] httpx.dispatch.http2 - send_headers stream_id=1 method='GET' target='/' headers=[(b':method', b'GET'), (b':authority', b'google.com'), (b':scheme', b'https'), (b':path', b'/'), (b'user-agent', b'python-httpx/0.7.6'), (b'accept', b'*/*'), (b'accept-encoding', b'gzip, deflate, br'), (b'connection', b'keep-alive')]
-TRACE [2019-11-06 19:18:56] httpx.dispatch.http2 - end_stream stream_id=1
-TRACE [2019-11-06 19:18:56] httpx.dispatch.http2 - receive_event stream_id=0 event=<RemoteSettingsChanged changed_settings:{ChangedSetting(setting=SettingCodes.MAX_CONCURRENT_STREAMS, original_value=None, new_value=100), ChangedSetting(setting=SettingCodes.INITIAL_WINDOW_SIZE, original_value=65535, new_value=1048576), ChangedSetting(setting=SettingCodes.MAX_HEADER_LIST_SIZE, original_value=None, new_value=16384)}>
-TRACE [2019-11-06 19:18:56] httpx.dispatch.http2 - receive_event stream_id=0 event=<WindowUpdated stream_id:0, delta:983041>
-TRACE [2019-11-06 19:18:56] httpx.dispatch.http2 - receive_event stream_id=0 event=<SettingsAcknowledged changed_settings:{}>
-TRACE [2019-11-06 19:18:56] httpx.dispatch.http2 - receive_event stream_id=1 event=<ResponseReceived stream_id:1, headers:[(b':status', b'301'), (b'location', b'https://www.google.com/'), (b'content-type', b'text/html; charset=UTF-8'), (b'date', b'Wed, 06 Nov 2019 18:18:56 GMT'), (b'expires', b'Fri, 06 Dec 2019 18:18:56 GMT'), (b'cache-control', b'public, max-age=2592000'), (b'server', b'gws'), (b'content-length', b'220'), (b'x-xss-protection', b'0'), (b'x-frame-options', b'SAMEORIGIN'), (b'alt-svc', b'quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000')]>
-DEBUG [2019-11-06 19:18:56] httpx.client - HTTP Request: GET https://google.com "HTTP/2 301 Moved Permanently"
-TRACE [2019-11-06 19:18:56] httpx.dispatch.connection_pool - acquire_connection origin=Origin(scheme='https' host='www.google.com' port=443)
-TRACE [2019-11-06 19:18:56] httpx.dispatch.connection_pool - new_connection connection=HTTPConnection(origin=Origin(scheme='https' host='www.google.com' port=443))
-TRACE [2019-11-06 19:18:56] httpx.config - load_ssl_context verify=True cert=None trust_env=True http_versions=HTTPVersionConfig(['HTTP/1.1', 'HTTP/2'])
-TRACE [2019-11-06 19:18:56] httpx.config - load_verify_locations cafile=/Users/florimond/Developer/python-projects/httpx/venv/lib/python3.8/site-packages/certifi/cacert.pem
-TRACE [2019-11-06 19:18:56] httpx.dispatch.connection - start_connect host='www.google.com' port=443 timeout=Timeout(timeout=5.0)
-TRACE [2019-11-06 19:18:56] httpx.dispatch.connection - connected http_version='HTTP/2'
-TRACE [2019-11-06 19:18:56] httpx.dispatch.http2 - send_headers stream_id=1 method='GET' target='/' headers=[(b':method', b'GET'), (b':authority', b'www.google.com'), (b':scheme', b'https'), (b':path', b'/'), (b'user-agent', b'python-httpx/0.7.6'), (b'accept', b'*/*'), (b'accept-encoding', b'gzip, deflate, br'), (b'connection', b'keep-alive')]
-TRACE [2019-11-06 19:18:56] httpx.dispatch.http2 - end_stream stream_id=1
-TRACE [2019-11-06 19:18:56] httpx.dispatch.http2 - receive_event stream_id=0 event=<RemoteSettingsChanged changed_settings:{ChangedSetting(setting=SettingCodes.MAX_CONCURRENT_STREAMS, original_value=None, new_value=100), ChangedSetting(setting=SettingCodes.INITIAL_WINDOW_SIZE, original_value=65535, new_value=1048576), ChangedSetting(setting=SettingCodes.MAX_HEADER_LIST_SIZE, original_value=None, new_value=16384)}>
-TRACE [2019-11-06 19:18:56] httpx.dispatch.http2 - receive_event stream_id=0 event=<WindowUpdated stream_id:0, delta:983041>
-TRACE [2019-11-06 19:18:56] httpx.dispatch.http2 - receive_event stream_id=0 event=<SettingsAcknowledged changed_settings:{}>
-TRACE [2019-11-06 19:18:56] httpx.dispatch.http2 - receive_event stream_id=1 event=<ResponseReceived stream_id:1, headers:[(b':status', b'200'), (b'date', b'Wed, 06 Nov 2019 18:18:56 GMT'), (b'expires', b'-1'), (b'cache-control', b'private, max-age=0'), (b'content-type', b'text/html; charset=ISO-8859-1'), (b'p3p', b'CP="This is not a P3P policy! See g.co/p3phelp for more info."'), (b'content-encoding', b'gzip'), (b'server', b'gws'), (b'content-length', b'5073'), (b'x-xss-protection', b'0'), (b'x-frame-options', b'SAMEORIGIN'), (b'set-cookie', b'1P_JAR=2019-11-06-18; expires=Fri, 06-Dec-2019 18:18:56 GMT; path=/; domain=.google.com; SameSite=none'), (b'set-cookie', b'NID=190=m8G9qLxCz2_4HbZI02ON2HTJF4xTvOhoJiS57Hm-OJrNS2eY20LfXMR_u-mLjujeshW5-BTezI69OGpHksT4ZK2TCDsWeU0DF7AmDTjjXFOdj30eIUTpNq7r9aWRvI8UrqiwlIsLkE8Ee3t5PiIiVdSMUcji7dkavGlMUpkMXU8; expires=Thu, 07-May-2020 18:18:56 GMT; path=/; domain=.google.com; HttpOnly'), (b'alt-svc', b'quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000')]>
-DEBUG [2019-11-06 19:18:56] httpx.client - HTTP Request: GET https://www.google.com/ "HTTP/2 200 OK"
-TRACE [2019-11-06 19:18:56] httpx.dispatch.http2 - receive_event stream_id=1 event=<DataReceived stream_id:1, flow_controlled_length:5186, data:1f8b08000000000002ffc55af97adb4692ff3f4f>
-TRACE [2019-11-06 19:18:56] httpx.dispatch.http2 - receive_event stream_id=1 event=<DataReceived stream_id:1, flow_controlled_length:221, data:>
-TRACE [2019-11-06 19:18:56] httpx.dispatch.http2 - receive_event stream_id=1 event=<StreamEnded stream_id:1>
-TRACE [2019-11-06 19:18:56] httpx.dispatch.http2 - receive_event stream_id=0 event=<PingReceived ping_data:0000000000000000>
-TRACE [2019-11-06 19:18:56] httpx.dispatch.connection_pool - release_connection connection=HTTPConnection(origin=Origin(scheme='https' host='www.google.com' port=443))
-TRACE [2019-11-06 19:18:56] httpx.dispatch.connection - close_connection
+TRACE [2019-11-06 19:18:56] httpx._dispatch.connection_pool - acquire_connection origin=Origin(scheme='https' host='google.com' port=443)
+TRACE [2019-11-06 19:18:56] httpx._dispatch.connection_pool - new_connection connection=HTTPConnection(origin=Origin(scheme='https' host='google.com' port=443))
+TRACE [2019-11-06 19:18:56] httpx._config - load_ssl_context verify=True cert=None trust_env=True http_versions=HTTPVersionConfig(['HTTP/1.1', 'HTTP/2'])
+TRACE [2019-11-06 19:18:56] httpx._config - load_verify_locations cafile=/Users/florimond/Developer/python-projects/httpx/venv/lib/python3.8/site-packages/certifi/cacert.pem
+TRACE [2019-11-06 19:18:56] httpx._dispatch.connection - start_connect host='google.com' port=443 timeout=Timeout(timeout=5.0)
+TRACE [2019-11-06 19:18:56] httpx._dispatch.connection - connected http_version='HTTP/2'
+TRACE [2019-11-06 19:18:56] httpx._dispatch.http2 - send_headers stream_id=1 method='GET' target='/' headers=[(b':method', b'GET'), (b':authority', b'google.com'), (b':scheme', b'https'), (b':path', b'/'), (b'user-agent', b'python-httpx/0.7.6'), (b'accept', b'*/*'), (b'accept-encoding', b'gzip, deflate, br'), (b'connection', b'keep-alive')]
+TRACE [2019-11-06 19:18:56] httpx._dispatch.http2 - end_stream stream_id=1
+TRACE [2019-11-06 19:18:56] httpx._dispatch.http2 - receive_event stream_id=0 event=<RemoteSettingsChanged changed_settings:{ChangedSetting(setting=SettingCodes.MAX_CONCURRENT_STREAMS, original_value=None, new_value=100), ChangedSetting(setting=SettingCodes.INITIAL_WINDOW_SIZE, original_value=65535, new_value=1048576), ChangedSetting(setting=SettingCodes.MAX_HEADER_LIST_SIZE, original_value=None, new_value=16384)}>
+TRACE [2019-11-06 19:18:56] httpx._dispatch.http2 - receive_event stream_id=0 event=<WindowUpdated stream_id:0, delta:983041>
+TRACE [2019-11-06 19:18:56] httpx._dispatch.http2 - receive_event stream_id=0 event=<SettingsAcknowledged changed_settings:{}>
+TRACE [2019-11-06 19:18:56] httpx._dispatch.http2 - receive_event stream_id=1 event=<ResponseReceived stream_id:1, headers:[(b':status', b'301'), (b'location', b'https://www.google.com/'), (b'content-type', b'text/html; charset=UTF-8'), (b'date', b'Wed, 06 Nov 2019 18:18:56 GMT'), (b'expires', b'Fri, 06 Dec 2019 18:18:56 GMT'), (b'cache-control', b'public, max-age=2592000'), (b'server', b'gws'), (b'content-length', b'220'), (b'x-xss-protection', b'0'), (b'x-frame-options', b'SAMEORIGIN'), (b'alt-svc', b'quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000')]>
+DEBUG [2019-11-06 19:18:56] httpx._client - HTTP Request: GET https://google.com "HTTP/2 301 Moved Permanently"
+TRACE [2019-11-06 19:18:56] httpx._dispatch.connection_pool - acquire_connection origin=Origin(scheme='https' host='www.google.com' port=443)
+TRACE [2019-11-06 19:18:56] httpx._dispatch.connection_pool - new_connection connection=HTTPConnection(origin=Origin(scheme='https' host='www.google.com' port=443))
+TRACE [2019-11-06 19:18:56] httpx._config - load_ssl_context verify=True cert=None trust_env=True http_versions=HTTPVersionConfig(['HTTP/1.1', 'HTTP/2'])
+TRACE [2019-11-06 19:18:56] httpx._config - load_verify_locations cafile=/Users/florimond/Developer/python-projects/httpx/venv/lib/python3.8/site-packages/certifi/cacert.pem
+TRACE [2019-11-06 19:18:56] httpx._dispatch.connection - start_connect host='www.google.com' port=443 timeout=Timeout(timeout=5.0)
+TRACE [2019-11-06 19:18:56] httpx._dispatch.connection - connected http_version='HTTP/2'
+TRACE [2019-11-06 19:18:56] httpx._dispatch.http2 - send_headers stream_id=1 method='GET' target='/' headers=[(b':method', b'GET'), (b':authority', b'www.google.com'), (b':scheme', b'https'), (b':path', b'/'), (b'user-agent', b'python-httpx/0.7.6'), (b'accept', b'*/*'), (b'accept-encoding', b'gzip, deflate, br'), (b'connection', b'keep-alive')]
+TRACE [2019-11-06 19:18:56] httpx._dispatch.http2 - end_stream stream_id=1
+TRACE [2019-11-06 19:18:56] httpx._dispatch.http2 - receive_event stream_id=0 event=<RemoteSettingsChanged changed_settings:{ChangedSetting(setting=SettingCodes.MAX_CONCURRENT_STREAMS, original_value=None, new_value=100), ChangedSetting(setting=SettingCodes.INITIAL_WINDOW_SIZE, original_value=65535, new_value=1048576), ChangedSetting(setting=SettingCodes.MAX_HEADER_LIST_SIZE, original_value=None, new_value=16384)}>
+TRACE [2019-11-06 19:18:56] httpx._dispatch.http2 - receive_event stream_id=0 event=<WindowUpdated stream_id:0, delta:983041>
+TRACE [2019-11-06 19:18:56] httpx._dispatch.http2 - receive_event stream_id=0 event=<SettingsAcknowledged changed_settings:{}>
+TRACE [2019-11-06 19:18:56] httpx._dispatch.http2 - receive_event stream_id=1 event=<ResponseReceived stream_id:1, headers:[(b':status', b'200'), (b'date', b'Wed, 06 Nov 2019 18:18:56 GMT'), (b'expires', b'-1'), (b'cache-control', b'private, max-age=0'), (b'content-type', b'text/html; charset=ISO-8859-1'), (b'p3p', b'CP="This is not a P3P policy! See g.co/p3phelp for more info."'), (b'content-encoding', b'gzip'), (b'server', b'gws'), (b'content-length', b'5073'), (b'x-xss-protection', b'0'), (b'x-frame-options', b'SAMEORIGIN'), (b'set-cookie', b'1P_JAR=2019-11-06-18; expires=Fri, 06-Dec-2019 18:18:56 GMT; path=/; domain=.google.com; SameSite=none'), (b'set-cookie', b'NID=190=m8G9qLxCz2_4HbZI02ON2HTJF4xTvOhoJiS57Hm-OJrNS2eY20LfXMR_u-mLjujeshW5-BTezI69OGpHksT4ZK2TCDsWeU0DF7AmDTjjXFOdj30eIUTpNq7r9aWRvI8UrqiwlIsLkE8Ee3t5PiIiVdSMUcji7dkavGlMUpkMXU8; expires=Thu, 07-May-2020 18:18:56 GMT; path=/; domain=.google.com; HttpOnly'), (b'alt-svc', b'quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000')]>
+DEBUG [2019-11-06 19:18:56] httpx._client - HTTP Request: GET https://www.google.com/ "HTTP/2 200 OK"
+TRACE [2019-11-06 19:18:56] httpx._dispatch.http2 - receive_event stream_id=1 event=<DataReceived stream_id:1, flow_controlled_length:5186, data:1f8b08000000000002ffc55af97adb4692ff3f4f>
+TRACE [2019-11-06 19:18:56] httpx._dispatch.http2 - receive_event stream_id=1 event=<DataReceived stream_id:1, flow_controlled_length:221, data:>
+TRACE [2019-11-06 19:18:56] httpx._dispatch.http2 - receive_event stream_id=1 event=<StreamEnded stream_id:1>
+TRACE [2019-11-06 19:18:56] httpx._dispatch.http2 - receive_event stream_id=0 event=<PingReceived ping_data:0000000000000000>
+TRACE [2019-11-06 19:18:56] httpx._dispatch.connection_pool - release_connection connection=HTTPConnection(origin=Origin(scheme='https' host='www.google.com' port=443))
+TRACE [2019-11-06 19:18:56] httpx._dispatch.connection - close_connection
 ```
 
 `SSLKEYLOGFILE`
index 4a133e8efdcb369e2805a7147ce7096ab5faf268..55f8526c59828c7eb23a58ed83d9a12053b3d730 100644 (file)
@@ -1,11 +1,11 @@
 from .__version__ import __description__, __title__, __version__
-from .api import delete, get, head, options, patch, post, put, request, stream
-from .auth import Auth, BasicAuth, DigestAuth
-from .client import AsyncClient, Client
-from .config import PoolLimits, Proxy, Timeout
-from .dispatch.asgi import ASGIDispatch
-from .dispatch.wsgi import WSGIDispatch
-from .exceptions import (
+from ._api import delete, get, head, options, patch, post, put, request, stream
+from ._auth import Auth, BasicAuth, DigestAuth
+from ._client import AsyncClient, Client
+from ._config import PoolLimits, Proxy, Timeout
+from ._dispatch.asgi import ASGIDispatch
+from ._dispatch.wsgi import WSGIDispatch
+from ._exceptions import (
     ConnectionClosed,
     ConnectTimeout,
     CookieConflict,
@@ -27,8 +27,8 @@ from .exceptions import (
     TooManyRedirects,
     WriteTimeout,
 )
-from .models import URL, Cookies, Headers, QueryParams, Request, Response
-from .status_codes import StatusCode, codes
+from ._models import URL, Cookies, Headers, QueryParams, Request, Response
+from ._status_codes import StatusCode, codes
 
 __all__ = [
     "__description__",
similarity index 98%
rename from httpx/api.py
rename to httpx/_api.py
index 7fbbd30811542117fbb4130bf4156dfb41e58ef7..19ef229fd83f7af2ae9773440d7b8214eadbacb6 100644 (file)
@@ -1,9 +1,9 @@
 import typing
 
-from .auth import AuthTypes
-from .client import Client, StreamContextManager
-from .config import DEFAULT_TIMEOUT_CONFIG, CertTypes, TimeoutTypes, VerifyTypes
-from .models import (
+from ._auth import AuthTypes
+from ._client import Client, StreamContextManager
+from ._config import DEFAULT_TIMEOUT_CONFIG, CertTypes, TimeoutTypes, VerifyTypes
+from ._models import (
     CookieTypes,
     HeaderTypes,
     QueryParamTypes,
similarity index 98%
rename from httpx/auth.py
rename to httpx/_auth.py
index d38322f7d73a467a7589b2d8f3e73b7c8a243117..c1fa8925355f5f3dbfcca6c0222934023116c0ab 100644 (file)
@@ -6,9 +6,9 @@ import typing
 from base64 import b64encode
 from urllib.request import parse_http_list
 
-from .exceptions import ProtocolError, RequestBodyUnavailable
-from .models import Request, Response
-from .utils import to_bytes, to_str, unquote
+from ._exceptions import ProtocolError, RequestBodyUnavailable
+from ._models import Request, Response
+from ._utils import to_bytes, to_str, unquote
 
 AuthTypes = typing.Union[
     typing.Tuple[typing.Union[str, bytes], typing.Union[str, bytes]],
similarity index 98%
rename from httpx/backends/asyncio.py
rename to httpx/_backends/asyncio.py
index 8d1025748bd07eaeea44c689ce19c9f881e926bf..c576909fab49b51e58b7e826fd67dc23e609fc74 100644 (file)
@@ -2,9 +2,9 @@ import asyncio
 import ssl
 import typing
 
-from ..config import Timeout
-from ..exceptions import ConnectTimeout, ReadTimeout, WriteTimeout
-from ..utils import as_network_error
+from .._config import Timeout
+from .._exceptions import ConnectTimeout, ReadTimeout, WriteTimeout
+from .._utils import as_network_error
 from .base import BaseLock, BaseSemaphore, BaseSocketStream, ConcurrencyBackend
 
 SSL_MONKEY_PATCH_APPLIED = False
similarity index 98%
rename from httpx/backends/auto.py
rename to httpx/_backends/auto.py
index 7a8c597822104f037df0262c283aae4c0fec6ad5..d034693b218bda255fb2b465b8df5c0f3a0a9ab3 100644 (file)
@@ -3,7 +3,7 @@ import typing
 
 import sniffio
 
-from ..config import Timeout
+from .._config import Timeout
 from .base import (
     BaseLock,
     BaseSemaphore,
similarity index 99%
rename from httpx/backends/base.py
rename to httpx/_backends/base.py
index 964d09449f098d83178b401b508251398a128cd2..8871063405605c330bb717624b0859e004c5ae93 100644 (file)
@@ -2,7 +2,7 @@ import ssl
 import typing
 from types import TracebackType
 
-from ..config import Timeout
+from .._config import Timeout
 
 
 def lookup_backend(
similarity index 97%
rename from httpx/backends/trio.py
rename to httpx/_backends/trio.py
index 33e93e9677e21f5b51cef933d54a88d7702df55b..e89340a4cbf9d658d4817fed0fd6a8ec30a95987 100644 (file)
@@ -3,9 +3,9 @@ import typing
 
 import trio
 
-from ..config import Timeout
-from ..exceptions import ConnectTimeout, ReadTimeout, WriteTimeout
-from ..utils import as_network_error
+from .._config import Timeout
+from .._exceptions import ConnectTimeout, ReadTimeout, WriteTimeout
+from .._utils import as_network_error
 from .base import BaseLock, BaseSemaphore, BaseSocketStream, ConcurrencyBackend
 
 
similarity index 98%
rename from httpx/client.py
rename to httpx/_client.py
index 49914787a88e168ad45fb7f6e695fc47b3eee258..109c8351f8de97e8f0bf4328b2215ea9e1278362 100644 (file)
@@ -4,9 +4,9 @@ from types import TracebackType
 
 import hstspreload
 
-from .auth import Auth, AuthTypes, BasicAuth, FunctionAuth
-from .backends.base import ConcurrencyBackend
-from .config import (
+from ._auth import Auth, AuthTypes, BasicAuth, FunctionAuth
+from ._backends.base import ConcurrencyBackend
+from ._config import (
     DEFAULT_MAX_REDIRECTS,
     DEFAULT_POOL_LIMITS,
     DEFAULT_TIMEOUT_CONFIG,
@@ -20,21 +20,21 @@ from .config import (
     UnsetType,
     VerifyTypes,
 )
-from .content_streams import ContentStream
-from .dispatch.asgi import ASGIDispatch
-from .dispatch.base import AsyncDispatcher, SyncDispatcher
-from .dispatch.connection_pool import ConnectionPool
-from .dispatch.proxy_http import HTTPProxy
-from .dispatch.urllib3 import URLLib3Dispatcher
-from .dispatch.wsgi import WSGIDispatch
-from .exceptions import (
+from ._content_streams import ContentStream
+from ._dispatch.asgi import ASGIDispatch
+from ._dispatch.base import AsyncDispatcher, SyncDispatcher
+from ._dispatch.connection_pool import ConnectionPool
+from ._dispatch.proxy_http import HTTPProxy
+from ._dispatch.urllib3 import URLLib3Dispatcher
+from ._dispatch.wsgi import WSGIDispatch
+from ._exceptions import (
     HTTPError,
     InvalidURL,
     RedirectLoop,
     RequestBodyUnavailable,
     TooManyRedirects,
 )
-from .models import (
+from ._models import (
     URL,
     Cookies,
     CookieTypes,
@@ -49,8 +49,8 @@ from .models import (
     Response,
     URLTypes,
 )
-from .status_codes import codes
-from .utils import NetRCInfo, get_environment_proxies, get_logger
+from ._status_codes import codes
+from ._utils import NetRCInfo, get_environment_proxies, get_logger
 
 logger = get_logger(__name__)
 
similarity index 99%
rename from httpx/config.py
rename to httpx/_config.py
index 64c3c3307dcc2c26a2d29a47186332dc2e651633..1531e2e804381a3309598fa377777e89e8e3c4f6 100644 (file)
@@ -6,8 +6,8 @@ from pathlib import Path
 
 import certifi
 
-from .models import URL, Headers, HeaderTypes, URLTypes
-from .utils import get_ca_bundle_from_env, get_logger
+from ._models import URL, Headers, HeaderTypes, URLTypes
+from ._utils import get_ca_bundle_from_env, get_logger
 
 CertTypes = typing.Union[str, typing.Tuple[str, str], typing.Tuple[str, str, str]]
 VerifyTypes = typing.Union[str, bool, ssl.SSLContext]
similarity index 99%
rename from httpx/content_streams.py
rename to httpx/_content_streams.py
index e3e343cf0826afdaa7fb907eb1292f9876130937..ca48326835c73de21e4be3b712d829a45832721d 100644 (file)
@@ -7,8 +7,8 @@ from json import dumps as json_dumps
 from pathlib import Path
 from urllib.parse import urlencode
 
-from .exceptions import StreamConsumed
-from .utils import format_form_param
+from ._exceptions import StreamConsumed
+from ._utils import format_form_param
 
 RequestData = typing.Union[
     dict, str, bytes, typing.Iterator[bytes], typing.AsyncIterator[bytes]
similarity index 99%
rename from httpx/decoders.py
rename to httpx/_decoders.py
index 454ec4a11a194c6d0cba30f3e9bf49836273b06a..cecd65da7f62889487299e75fc43e50b927da284 100644 (file)
@@ -9,7 +9,7 @@ import zlib
 
 import chardet
 
-from .exceptions import DecodingError
+from ._exceptions import DecodingError
 
 try:
     import brotli
similarity index 97%
rename from httpx/dispatch/asgi.py
rename to httpx/_dispatch/asgi.py
index a0b55e2b16ba957ecb3defcce0282b9889ba8a70..d15dfb8c5b48113077c7256128a08c7d2f9daa37 100644 (file)
@@ -1,8 +1,8 @@
 import typing
 
-from ..config import TimeoutTypes
-from ..content_streams import ByteStream
-from ..models import Request, Response
+from .._config import TimeoutTypes
+from .._content_streams import ByteStream
+from .._models import Request, Response
 from .base import AsyncDispatcher
 
 
similarity index 96%
rename from httpx/dispatch/base.py
rename to httpx/_dispatch/base.py
index ae25e4db4c774af65efcc7fdbc30c98d23c76ec5..26defd197f74c9f32b9bfd5ee5b3544d2380a5f8 100644 (file)
@@ -1,8 +1,8 @@
 import typing
 from types import TracebackType
 
-from ..config import Timeout
-from ..models import (
+from .._config import Timeout
+from .._models import (
     HeaderTypes,
     QueryParamTypes,
     Request,
similarity index 96%
rename from httpx/dispatch/connection.py
rename to httpx/_dispatch/connection.py
index 9b6b28b7c964591b534da0661ef72749f7eeea22..5d8984588c106012b0c0d4b6acc92cf86ac0343d 100644 (file)
@@ -3,10 +3,10 @@ import typing
 
 import h11
 
-from ..backends.base import ConcurrencyBackend, lookup_backend
-from ..config import SSLConfig, Timeout
-from ..models import URL, Origin, Request, Response
-from ..utils import get_logger
+from .._backends.base import ConcurrencyBackend, lookup_backend
+from .._config import SSLConfig, Timeout
+from .._models import URL, Origin, Request, Response
+from .._utils import get_logger
 from .base import AsyncDispatcher
 from .http2 import HTTP2Connection
 from .http11 import HTTP11Connection
similarity index 97%
rename from httpx/dispatch/connection_pool.py
rename to httpx/_dispatch/connection_pool.py
index eb2a11a5d053880338aab45cb59d12d78f5de3a4..61d323c55ce78cc849dbd08965217c92aea522c6 100644 (file)
@@ -1,7 +1,7 @@
 import typing
 
-from ..backends.base import BaseSemaphore, ConcurrencyBackend, lookup_backend
-from ..config import (
+from .._backends.base import BaseSemaphore, ConcurrencyBackend, lookup_backend
+from .._config import (
     DEFAULT_POOL_LIMITS,
     CertTypes,
     PoolLimits,
@@ -9,9 +9,9 @@ from ..config import (
     Timeout,
     VerifyTypes,
 )
-from ..exceptions import PoolTimeout
-from ..models import Origin, Request, Response
-from ..utils import get_logger
+from .._exceptions import PoolTimeout
+from .._models import Origin, Request, Response
+from .._utils import get_logger
 from .base import AsyncDispatcher
 from .connection import HTTPConnection
 
similarity index 96%
rename from httpx/dispatch/http11.py
rename to httpx/_dispatch/http11.py
index 2ed3384562ee8d14523f890a10d483269271e360..fce9882703f77854927eef0176ca09d9e90204f8 100644 (file)
@@ -2,12 +2,12 @@ import typing
 
 import h11
 
-from ..backends.base import BaseSocketStream
-from ..config import Timeout
-from ..content_streams import AsyncIteratorStream
-from ..exceptions import ConnectionClosed, ProtocolError
-from ..models import Request, Response
-from ..utils import get_logger
+from .._backends.base import BaseSocketStream
+from .._config import Timeout
+from .._content_streams import AsyncIteratorStream
+from .._exceptions import ConnectionClosed, ProtocolError
+from .._models import Request, Response
+from .._utils import get_logger
 
 H11Event = typing.Union[
     h11.Request,
similarity index 97%
rename from httpx/dispatch/http2.py
rename to httpx/_dispatch/http2.py
index a85d46b6ba4ace4f1738e2e1e42014b606ccd47c..d5724de52b193803a1179583e6ca888c95cef3c6 100644 (file)
@@ -5,17 +5,17 @@ import h2.events
 from h2.config import H2Configuration
 from h2.settings import SettingCodes, Settings
 
-from ..backends.base import (
+from .._backends.base import (
     BaseLock,
     BaseSocketStream,
     ConcurrencyBackend,
     lookup_backend,
 )
-from ..config import Timeout
-from ..content_streams import AsyncIteratorStream
-from ..exceptions import ProtocolError
-from ..models import Request, Response
-from ..utils import get_logger
+from .._config import Timeout
+from .._content_streams import AsyncIteratorStream
+from .._exceptions import ProtocolError
+from .._models import Request, Response
+from .._utils import get_logger
 
 logger = get_logger(__name__)
 
similarity index 96%
rename from httpx/dispatch/proxy_http.py
rename to httpx/_dispatch/proxy_http.py
index 743e04d33f640fc7d5d6cdce4e8c8f376fbd732b..73cea2ba1762d21ddb9888f38c40e1a7aee4d7f1 100644 (file)
@@ -3,8 +3,8 @@ import typing
 import warnings
 from base64 import b64encode
 
-from ..backends.base import ConcurrencyBackend
-from ..config import (
+from .._backends.base import ConcurrencyBackend
+from .._config import (
     DEFAULT_POOL_LIMITS,
     CertTypes,
     PoolLimits,
@@ -12,9 +12,9 @@ from ..config import (
     Timeout,
     VerifyTypes,
 )
-from ..exceptions import ProxyError
-from ..models import URL, Headers, HeaderTypes, Origin, Request, Response, URLTypes
-from ..utils import get_logger
+from .._exceptions import ProxyError
+from .._models import URL, Headers, HeaderTypes, Origin, Request, Response, URLTypes
+from .._utils import get_logger
 from .connection import HTTPConnection
 from .connection_pool import ConnectionPool
 
similarity index 96%
rename from httpx/dispatch/urllib3.py
rename to httpx/_dispatch/urllib3.py
index 2728170c140b5fa4504fe5419b76731b0880d5cb..bde2952f4ac13d097249e9ed4f21b5e4964d3c39 100644 (file)
@@ -6,7 +6,7 @@ import typing
 import urllib3
 from urllib3.exceptions import MaxRetryError, SSLError
 
-from ..config import (
+from .._config import (
     DEFAULT_POOL_LIMITS,
     CertTypes,
     PoolLimits,
@@ -15,9 +15,9 @@ from ..config import (
     Timeout,
     VerifyTypes,
 )
-from ..content_streams import IteratorStream
-from ..models import Request, Response
-from ..utils import as_network_error
+from .._content_streams import IteratorStream
+from .._models import Request, Response
+from .._utils import as_network_error
 from .base import SyncDispatcher
 
 
similarity index 96%
rename from httpx/dispatch/wsgi.py
rename to httpx/_dispatch/wsgi.py
index 2a90187c604c5c6a56fe41fae47fb3d7d4c8c031..60540a8b5cc9a5e793a711e0af2050698f2ce819 100644 (file)
@@ -1,9 +1,9 @@
 import io
 import typing
 
-from ..config import TimeoutTypes
-from ..content_streams import IteratorStream
-from ..models import Request, Response
+from .._config import TimeoutTypes
+from .._content_streams import IteratorStream
+from .._models import Request, Response
 from .base import SyncDispatcher
 
 
similarity index 97%
rename from httpx/exceptions.py
rename to httpx/_exceptions.py
index 7efe6fb3c92329cc649f465af1a45c08c4a778e6..562c2ed62cff19c3b5f7c8d31408bd5f6989375b 100644 (file)
@@ -1,7 +1,7 @@
 import typing
 
 if typing.TYPE_CHECKING:
-    from .models import Request, Response  # pragma: nocover
+    from ._models import Request, Response  # pragma: nocover
 
 
 class HTTPError(Exception):
similarity index 99%
rename from httpx/models.py
rename to httpx/_models.py
index 8d22738b14d2341beb643000a6eafeda0809924a..861e85fab6cd9b5604ad608b21e4b668784e408b 100644 (file)
@@ -13,14 +13,14 @@ import chardet
 import rfc3986
 
 from .__version__ import __version__
-from .content_streams import (
+from ._content_streams import (
     ByteStream,
     ContentStream,
     RequestData,
     RequestFiles,
     encode,
 )
-from .decoders import (
+from ._decoders import (
     SUPPORTED_DECODERS,
     Decoder,
     IdentityDecoder,
@@ -28,7 +28,7 @@ from .decoders import (
     MultiDecoder,
     TextDecoder,
 )
-from .exceptions import (
+from ._exceptions import (
     CookieConflict,
     HTTPError,
     InvalidURL,
@@ -38,8 +38,8 @@ from .exceptions import (
     ResponseNotRead,
     StreamConsumed,
 )
-from .status_codes import StatusCode
-from .utils import (
+from ._status_codes import StatusCode
+from ._utils import (
     ElapsedTimer,
     flatten_queryparams,
     guess_json_utf,
@@ -52,7 +52,7 @@ from .utils import (
 )
 
 if typing.TYPE_CHECKING:  # pragma: no cover
-    from .dispatch.base import AsyncDispatcher  # noqa: F401
+    from ._dispatch.base import AsyncDispatcher  # noqa: F401
 
 PrimitiveData = typing.Optional[typing.Union[str, int, float, bool]]
 
similarity index 100%
rename from httpx/status_codes.py
rename to httpx/_status_codes.py
similarity index 99%
rename from httpx/utils.py
rename to httpx/_utils.py
index 5700a1cc8affba3086e6f06149073c74708338da..b884f8193e1db6d868d36a0df273280e3b9cb51d 100644 (file)
@@ -13,11 +13,11 @@ from time import perf_counter
 from types import TracebackType
 from urllib.request import getproxies
 
-from .exceptions import NetworkError
+from ._exceptions import NetworkError
 
 if typing.TYPE_CHECKING:  # pragma: no cover
-    from .models import PrimitiveData
-    from .models import URL
+    from ._models import PrimitiveData
+    from ._models import URL
 
 
 _HTML5_FORM_ENCODING_REPLACEMENTS = {'"': "%22", "\\": "\\\\"}
index 8449b941e0adc02e4e9d5f721f98aabe4a325439..10bdb8715119cafafba179643525a9f04e61b508 100644 (file)
@@ -15,8 +15,8 @@ from httpx import (
     RequestBodyUnavailable,
     Response,
 )
-from httpx.config import CertTypes, TimeoutTypes, VerifyTypes
-from httpx.dispatch.base import AsyncDispatcher
+from httpx._config import CertTypes, TimeoutTypes, VerifyTypes
+from httpx._dispatch.base import AsyncDispatcher
 
 
 class MockDispatch(AsyncDispatcher):
index 2932232d320444402fbb7733955f8165ce631fe1..f5bb21fe01768295778ad921f5dd3bf2f8314a2c 100644 (file)
@@ -4,8 +4,8 @@ from http.cookiejar import Cookie, CookieJar
 import pytest
 
 from httpx import AsyncClient, Cookies, Request, Response
-from httpx.config import CertTypes, TimeoutTypes, VerifyTypes
-from httpx.dispatch.base import AsyncDispatcher
+from httpx._config import CertTypes, TimeoutTypes, VerifyTypes
+from httpx._dispatch.base import AsyncDispatcher
 
 
 class MockDispatch(AsyncDispatcher):
index 56cf24c71fdc8031d991bc2547df77fb7f14c1b0..22b0ba1e89a64c69a842a386fbbbcaf7eec1766f 100755 (executable)
@@ -5,8 +5,8 @@ import json
 import pytest
 
 from httpx import AsyncClient, Headers, Request, Response, __version__
-from httpx.config import CertTypes, TimeoutTypes, VerifyTypes
-from httpx.dispatch.base import AsyncDispatcher
+from httpx._config import CertTypes, TimeoutTypes, VerifyTypes
+from httpx._dispatch.base import AsyncDispatcher
 
 
 class MockDispatch(AsyncDispatcher):
index e0ce45b2d2ef61fb90e2325f3f01a1d04697b44e..1c029f390b8b101a418b4d010f81e4856ebec19c 100644 (file)
@@ -3,8 +3,8 @@ import json
 import pytest
 
 from httpx import URL, AsyncClient, QueryParams, Request, Response
-from httpx.config import CertTypes, TimeoutTypes, VerifyTypes
-from httpx.dispatch.base import AsyncDispatcher
+from httpx._config import CertTypes, TimeoutTypes, VerifyTypes
+from httpx._dispatch.base import AsyncDispatcher
 
 
 class MockDispatch(AsyncDispatcher):
index 1717d782a55bf7f437f427e5f2fb0ec40db0c47a..ad138e52bfa009bfbde9f0f955ecd0a07178829f 100644 (file)
@@ -14,9 +14,9 @@ from httpx import (
     TooManyRedirects,
     codes,
 )
-from httpx.config import CertTypes, TimeoutTypes, VerifyTypes
-from httpx.content_streams import AsyncIteratorStream
-from httpx.dispatch.base import AsyncDispatcher
+from httpx._config import CertTypes, TimeoutTypes, VerifyTypes
+from httpx._content_streams import AsyncIteratorStream
+from httpx._dispatch.base import AsyncDispatcher
 
 
 class MockDispatch(AsyncDispatcher):
index 55c1609984e6ad9d8e79f77159a102a481c39e74..7c656cfd8076f9fa37864d973b5eccf3f3c48e04 100644 (file)
@@ -1,7 +1,7 @@
 import pytest
 
 import httpx
-from httpx.dispatch.connection_pool import ConnectionPool
+from httpx._dispatch.connection_pool import ConnectionPool
 
 
 @pytest.mark.usefixtures("async_environment")
index 80dd6a46b371c74480da0a3aeb3a943e39cda5a7..8668c28ab37d77278eb6c72da6cb7aa44ca6e3f6 100644 (file)
@@ -1,8 +1,8 @@
 import pytest
 
 import httpx
-from httpx.config import SSLConfig
-from httpx.dispatch.connection import HTTPConnection
+from httpx._config import SSLConfig
+from httpx._dispatch.connection import HTTPConnection
 
 
 @pytest.mark.usefixtures("async_environment")
index bdb4d6bf8bf29326df2b67aa7306c625954d8b8e..60c326a2340ce70b7e3d2d0b424b402b3c607737 100644 (file)
@@ -1,7 +1,7 @@
 import pytest
 
 import httpx
-from httpx.dispatch.proxy_http import HTTPProxy
+from httpx._dispatch.proxy_http import HTTPProxy
 
 from .utils import MockRawSocketBackend
 
index 5f92cd82d36700ca11c625d9263746b11011cac9..9939d6d297f33cbb76f5d652ebc61cb6779a6ed5 100644 (file)
@@ -6,7 +6,7 @@ import h2.connection
 import h2.events
 
 from httpx import Request, Timeout
-from httpx.backends.base import BaseSocketStream, lookup_backend
+from httpx._backends.base import BaseSocketStream, lookup_backend
 
 
 class MockHTTP2Backend:
index 80cbfb08e1d6d8ec7777caca789a7d663b24bf0c..1935aba3e5a1c80ab9ca50a4f046a0a3a6fb4ec0 100644 (file)
@@ -5,7 +5,7 @@ from unittest import mock
 import pytest
 
 import httpx
-from httpx.content_streams import AsyncIteratorStream, IteratorStream
+from httpx._content_streams import AsyncIteratorStream, IteratorStream
 
 REQUEST = httpx.Request("GET", "https://example.org")
 
@@ -369,7 +369,7 @@ def test_json_without_specified_encoding_decode_error():
     content = json.dumps(data).encode("utf-32-be")
     headers = {"Content-Type": "application/json"}
     # force incorrect guess from `guess_json_utf` to trigger error
-    with mock.patch("httpx.models.guess_json_utf", return_value="utf-32"):
+    with mock.patch("httpx._models.guess_json_utf", return_value="utf-32"):
         response = httpx.Response(
             200, content=content, headers=headers, request=REQUEST
         )
index 4be287d936e6091ef037f660e99e761493d479ea..cb2f3ee162ad7f41fb1a6b5eb980f7a1f48dbd12 100644 (file)
@@ -1,7 +1,7 @@
 import pytest
 
 from httpx import URL, InvalidURL
-from httpx.models import Origin
+from httpx._models import Origin
 
 
 @pytest.mark.parametrize(
index 3ed755209a61c47302f2add6073af79899e0945b..f0045d0563dfe7599e177fef60c3492216a55ea2 100644 (file)
@@ -4,10 +4,10 @@ import pytest
 import trio
 
 from httpx import Timeout
-from httpx.backends.asyncio import AsyncioBackend
-from httpx.backends.base import lookup_backend
-from httpx.backends.trio import TrioBackend
-from httpx.config import SSLConfig
+from httpx._backends.asyncio import AsyncioBackend
+from httpx._backends.base import lookup_backend
+from httpx._backends.trio import TrioBackend
+from httpx._config import SSLConfig
 from tests.concurrency import get_cipher, run_concurrently
 
 
index 8507c710de60b1cfcca28b42e00a6a5bf8e361af..f0ecf317e22daa4f84257c0dd0bc791be4c6da39 100644 (file)
@@ -8,7 +8,7 @@ import certifi
 import pytest
 
 import httpx
-from httpx.config import SSLConfig
+from httpx._config import SSLConfig
 
 
 def test_load_ssl_config():
index 93baf8e7013254b95348df82755ac6dc540831a1..6aa91f40d4bd476d278af716eb3ae810cc5ff16c 100644 (file)
@@ -2,8 +2,8 @@ import io
 
 import pytest
 
-from httpx.content_streams import ContentStream, encode
-from httpx.exceptions import StreamConsumed
+from httpx import StreamConsumed
+from httpx._content_streams import ContentStream, encode
 
 
 @pytest.mark.asyncio
index d9e82f702f9774621dd2594aa6ef28b38afe50ca..9f2fa51032bc718d58d5c9f9a41f27a8fc8ccba3 100644 (file)
@@ -4,8 +4,8 @@ import brotli
 import pytest
 
 import httpx
-from httpx.content_streams import AsyncIteratorStream
-from httpx.decoders import (
+from httpx._content_streams import AsyncIteratorStream
+from httpx._decoders import (
     BrotliDecoder,
     DeflateDecoder,
     GZipDecoder,
index e0bd750cc7194b47682fa9d3e63c977e7b3f3ce1..a08ada80ce513a57dce011fa27cf995ad93aec56 100644 (file)
@@ -7,10 +7,10 @@ from unittest import mock
 import pytest
 
 import httpx
-from httpx.config import CertTypes, TimeoutTypes, VerifyTypes
-from httpx.content_streams import encode
-from httpx.dispatch.base import AsyncDispatcher
-from httpx.utils import format_form_param
+from httpx._config import CertTypes, TimeoutTypes, VerifyTypes
+from httpx._content_streams import encode
+from httpx._dispatch.base import AsyncDispatcher
+from httpx._utils import format_form_param
 
 
 class MockDispatch(AsyncDispatcher):
index c062801650f65a2593c1b579d0ab68871d990c79..e6d035558e8f4b1370e17306638a05459be0eb44 100644 (file)
@@ -4,7 +4,7 @@ import os
 import pytest
 
 import httpx
-from httpx.utils import (
+from httpx._utils import (
     ElapsedTimer,
     NetRCInfo,
     get_ca_bundle_from_env,
@@ -98,7 +98,7 @@ async def test_logs_debug(server, capsys):
             assert response.status_code == 200
     stderr = capsys.readouterr().err
     assert 'HTTP Request: GET http://127.0.0.1:8000/ "HTTP/1.1 200 OK"' in stderr
-    assert "httpx.dispatch.connection_pool" not in stderr
+    assert "httpx._dispatch.connection_pool" not in stderr
 
 
 @pytest.mark.asyncio
@@ -109,7 +109,7 @@ async def test_logs_trace(server, capsys):
             assert response.status_code == 200
     stderr = capsys.readouterr().err
     assert 'HTTP Request: GET http://127.0.0.1:8000/ "HTTP/1.1 200 OK"' in stderr
-    assert "httpx.dispatch.connection_pool" in stderr
+    assert "httpx._dispatch.connection_pool" in stderr
 
 
 @pytest.mark.asyncio
@@ -283,5 +283,5 @@ def test_obfuscate_sensitive_headers(headers, output):
 )
 def test_should_not_be_proxied(url, no_proxy, expected):
     os.environ.update(no_proxy)
-    parsed_url = httpx.models.URL(url)
+    parsed_url = httpx.URL(url)
     assert should_not_be_proxied(parsed_url) == expected
index 5084022785523e0edae721615943ae4fc8440b0c..e2636a535cfb5ac2dcc96fb3cfd974ae7ada134a 100644 (file)
@@ -2,7 +2,7 @@ import contextlib
 import logging
 import os
 
-from httpx import utils
+from httpx import _utils
 
 
 @contextlib.contextmanager
@@ -10,8 +10,8 @@ def override_log_level(log_level: str):
     os.environ["HTTPX_LOG_LEVEL"] = log_level
 
     # Force a reload on the logging handlers
-    utils._LOGGER_INITIALIZED = False
-    utils.get_logger("httpx")
+    _utils._LOGGER_INITIALIZED = False
+    _utils.get_logger("httpx")
 
     try:
         yield