You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dose httpx support https proxy now?
My test code just lick that:
proxies = {
"http://": "http://127.0.0.1:8888",
"https://": "https://127.0.0.1:8888", # "http://127.0.0.1:8888"
}
context = httpx.create_ssl_context(verify="/Users/onlythen/Documents/Charles.pem")
client = httpx.Client(http2=True, verify=context, proxies=proxies) # (http2=True) this will work fine
headers = {
'Host': 'pixabay.com',
'upgrade-insecure-requests': '1',
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36',
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'sec-fetch-site': 'none',
'sec-fetch-mode': 'navigate',
'sec-fetch-dest': 'document',
'accept-language': 'zh-CN,zh;q=0.9'
}
response = client.get('https://pixabay.com/images/search/cat/', headers=headers)
if response.status_code == 200:
print(response.text)
print(response.http_version)
After open charles and start proxy, those code will show ssl error:
do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)
During handling of the above exception, another exception occurred:
And in charles it show status code 503: Invalid first line in request.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Dose httpx support https proxy now?
My test code just lick that:
After open charles and start proxy, those code will show ssl error:
And in charles it show status code 503: Invalid first line in request.
Beta Was this translation helpful? Give feedback.
All reactions