Repository: encode/httpx
Pull request: Drop proxies arg from the high level API
Closes https://github.com/encode/httpx/issues/480


Problem statement:
Drop proxies argument from top-level API functions.
Somehow the `proxies` argument has crept into our top-level API functions (eg. `httpx.get()`).
It's not actually wired up anyplace. We should drop the argument for now.

We *will* want per-request control for proxies, but that should be implemented alongside adding support for `proxies=...` on the Client methods (eg. `client.get(...)`), which we currently erronously document, but do not support.

Hints from issue discussion:

Commit message: Add note on not supporting proxies at request level

Patch to review:
diff --git a/docs/advanced.md b/docs/advanced.md
index 973ffed486..b9fa085b7d 100644
--- a/docs/advanced.md
+++ b/docs/advanced.md
@@ -168,6 +168,11 @@ client = httpx.Client(proxies=proxy)
 client.get("http://example.com")
 ```
 
+!!! note
+
+    Per request proxy configuration, i.e. `client.get(url, proxies=...)`,
+    have not yet been implemented. To use proxies you must pass the proxy
+    information at `Client` initialization.
 
 ## Timeout fine-tuning
 HTTPX offers various request timeout management options. Three types of timeouts are available: **connect** timeouts, 
diff --git a/docs/index.md b/docs/index.md
index 84e25543c5..b09394b139 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -66,7 +66,7 @@ Plus all the standard features of `requests`...
 * Keep-Alive & Connection Pooling
 * Sessions with Cookie Persistence
 * Browser-style SSL Verification
-* Basic/Digest Authentication *(Digest is still TODO)*
+* Basic/Digest Authentication
 * Elegant Key/Value Cookies
 * Automatic Decompression
 * Automatic Content Decoding
diff --git a/httpx/api.py b/httpx/api.py
index 3afb65faf0..5d134b0c9a 100644
--- a/httpx/api.py
+++ b/httpx/api.py
@@ -6,7 +6,6 @@
     AuthTypes,
     CookieTypes,
     HeaderTypes,
-    ProxiesTypes,
     QueryParamTypes,
     RequestData,
     RequestFiles,
@@ -32,7 +31,6 @@ def request(
     verify: VerifyTypes = True,
     stream: bool = False,
     trust_env: bool = None,
-    proxies: ProxiesTypes = None,
 ) -> Response:
     with Client(http_versions=["HTTP/1.1"]) as client:
         return client.request(
@@ -67,7 +65,6 @@ def get(
     verify: VerifyTypes = True,
     timeout: TimeoutTypes = None,
     trust_env: bool = None,
-    proxies: ProxiesTypes = None,
 ) -> Response:
     return request(
         "GET",
@@ -98,7 +95,6 @@ def options(
     verify: VerifyTypes = True,
     timeout: TimeoutTypes = None,
     trust_env: bool = None,
-    proxies: ProxiesTypes = None,
 ) -> Response:
     return request(
         "OPTIONS",
@@ -129,7 +125,6 @@ def head(
     verify: VerifyTypes = True,
     timeout: TimeoutTypes = None,
     trust_env: bool = None,
-    proxies: ProxiesTypes = None,
 ) -> Response:
     return request(
         "HEAD",
@@ -163,7 +158,6 @@ def post(
     verify: VerifyTypes = True,
     timeout: TimeoutTypes = None,
     trust_env: bool = None,
-    proxies: ProxiesTypes = None,
 ) -> Response:
     return request(
         "POST",
@@ -200,7 +194,6 @@ def put(
     verify: VerifyTypes = True,
     timeout: TimeoutTypes = None,
     trust_env: bool = None,
-    proxies: ProxiesTypes = None,
 ) -> Response:
     return request(
         "PUT",
@@ -237,7 +230,6 @@ def patch(
     verify: VerifyTypes = True,
     timeout: TimeoutTypes = None,
     trust_env: bool = None,
-    proxies: ProxiesTypes = None,
 ) -> Response:
     return request(
         "PATCH",
@@ -271,7 +263,6 @@ def delete(
     verify: VerifyTypes = True,
     timeout: TimeoutTypes = None,
     trust_env: bool = None,
-    proxies: ProxiesTypes = None,
 ) -> Response:
     return request(
         "DELETE",


Code review comments:
diff_hunk: @@ -168,6 +168,11 @@ client = httpx.Client(proxies=proxy)
 client.get("http://example.com")
 ```
 
+!!! note
+
+    Per request proxy configuration, i.e. `client.get(url, proxies=...)`,
+    have not yet been implemented. To use proxies you must pass the proxy
path: docs/advanced.md
text: @user1:
```suggestion
    has not been implemented yet. To use proxies you must pass the proxy
```