Skip to content

Commit

Permalink
Drop deprecated proxies API (#1058)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchristie authored Jul 16, 2020
1 parent 3f96e74 commit ccd4711
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions httpx/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,11 @@ def get_proxy_map(
elif isinstance(proxies, (str, URL, Proxy)):
proxy = Proxy(url=proxies) if isinstance(proxies, (str, URL)) else proxies
return {"all": proxy}
elif isinstance(proxies, httpcore.AsyncHTTPTransport): # pragma: nocover
raise RuntimeError(
"Passing a transport instance to 'proxies=' is no longer "
"supported. Use `httpx.Proxy() instead.`"
)
else:
new_proxies = {}
for key, value in proxies.items():
if isinstance(value, (str, URL, Proxy)):
proxy = Proxy(url=value) if isinstance(value, (str, URL)) else value
new_proxies[str(key)] = proxy
elif isinstance(value, httpcore.AsyncHTTPTransport): # pragma: nocover
raise RuntimeError(
"Passing a transport instance to 'proxies=' is "
"no longer supported. Use `httpx.Proxy() instead.`"
)
proxy = Proxy(url=value) if isinstance(value, (str, URL)) else value
new_proxies[str(key)] = proxy
return new_proxies

@property
Expand Down

0 comments on commit ccd4711

Please sign in to comment.