Skip to content
Myr

troubleshooting.md

This file

Path

docs/troubleshooting.md

63 lines · 2.1 KiB · Markdown

Last changed by

Fix sections references (#3058)Kar Petrosyanbefore adoption73e6888

History of this file

Take it

The walk stopped after 200 commits: lines older than 883cf8c point at it.

Drop multipart requirement from tests (#2456)Tom Christiebefore adoption883cf8c

lines 1–21why, one step back
1# Troubleshooting
23This page lists some common problems or issues you could encounter while developing with HTTPX, as well as possible solutions.45## Proxies67---89### "`The handshake operation timed out`" on HTTPS requests when using a proxy1011**Description**: When using a proxy and making an HTTPS request, you see an exception looking like this:1213```console14httpx.ProxyError: _ssl.c:1091: The handshake operation timed out15```1617**Similar issues**: [encode/httpx#1412](https://github.com/encode/httpx/issues/1412), [encode/httpx#1433](https://github.com/encode/httpx/issues/1433)1819**Resolution**: it is likely that you've set up your proxies like this...2021```python

Add the 'proxy' parameter and deprecate 'proxies'. (#2879)Kar Petrosyanbefore adoptionf8981f3

lines 22–24why, one step back
22mounts = {
23 "http://": httpx.HTTPTransport(proxy="http://myproxy.org"),24 "https://": httpx.HTTPTransport(proxy="https://myproxy.org"),

Drop multipart requirement from tests (#2456)Tom Christiebefore adoption883cf8c

lines 25–29why, one step back
25}
26```2728Using this setup, you're telling HTTPX to connect to the proxy using HTTP for HTTP requests, and using HTTPS for HTTPS requests.29

Fix sections references (#3058)Kar Petrosyanbefore adoption73e6888

line 30why, one step back
30But if you get the error above, it is likely that your proxy doesn't support connecting via HTTPS. Don't worry: that's a [common gotcha](advanced/proxies.md#http-proxies).

Drop multipart requirement from tests (#2456)Tom Christiebefore adoption883cf8c

lines 31–34why, one step back
31
32Change the scheme of your HTTPS proxy to `http://...` instead of `https://...`:3334```python

Add the 'proxy' parameter and deprecate 'proxies'. (#2879)Kar Petrosyanbefore adoptionf8981f3

lines 35–37why, one step back
35mounts = {
36 "http://": httpx.HTTPTransport(proxy="http://myproxy.org"),37 "https://": httpx.HTTPTransport(proxy="http://myproxy.org"),

Drop multipart requirement from tests (#2456)Tom Christiebefore adoption883cf8c

lines 38–43why, one step back
38}
39```4041This can be simplified to:4243```python

Add the 'proxy' parameter and deprecate 'proxies'. (#2879)Kar Petrosyanbefore adoptionf8981f3

lines 44–46why, one step back
44proxy = "http://myproxy.org"
45with httpx.Client(proxy=proxy) as client:46 ...

Drop multipart requirement from tests (#2456)Tom Christiebefore adoption883cf8c

lines 47–48why, one step back
47```
48

Fix sections references (#3058)Kar Petrosyanbefore adoption73e6888

line 49why, one step back
49For more information, see [Proxies: FORWARD vs TUNNEL](advanced/proxies.md#forward-vs-tunnel).

Drop multipart requirement from tests (#2456)Tom Christiebefore adoption883cf8c

lines 50–63why, one step back
50
51---5253### Error when making requests to an HTTPS proxy5455**Description**: your proxy _does_ support connecting via HTTPS, but you are seeing errors along the lines of...5657```console58httpx.ProxyError: [SSL: PRE_MAC_LENGTH_TOO_LONG] invalid alert (_ssl.c:1091)59```6061**Similar issues**: [encode/httpx#1424](https://github.com/encode/httpx/issues/1424).6263**Resolution**: HTTPX does not properly support HTTPS proxies at this time. If that's something you're interested in having, please see [encode/httpx#1434](https://github.com/encode/httpx/issues/1434) and consider lending a hand there.