Jul-15-2020, 01:11 PM
Please consider the following python program.
ProxyError: HTTPSConnectionPool(host='www.washingtonpost.com', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x000001BC70C2FE48>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond',)))
However, if I do not use the proxy server it works. What am I doing wrong?
Thanks,
Bob
import requests
url = 'https://washingtonpost.com/'
proxy = {
"https": "https://202.29.237.212:3128",
"http": "http://202.29.237.212:3128"
}
text = requests.get(url, proxies=proxy)
# text = requests.get(url)
output = open("out.html", "w")
output.write(text.text)
output.close()When I run the program, it dies on the call to get with the following error messages:ProxyError: HTTPSConnectionPool(host='www.washingtonpost.com', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x000001BC70C2FE48>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond',)))
However, if I do not use the proxy server it works. What am I doing wrong?
Thanks,
Bob
