Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using a Proxy Server
#1
Please consider the following python program.
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
Reply


Messages In This Thread
Using a Proxy Server - by rsherry8 - Jul-15-2020, 01:11 PM
RE: Using a Proxy Server - by snippsat - Jul-15-2020, 01:25 PM
RE: Using a Proxy Server - by rsherry8 - Jul-15-2020, 03:54 PM
RE: Using a Proxy Server - by snippsat - Jul-15-2020, 04:49 PM
RE: Using a Proxy Server - by EthanPayne - Sep-05-2020, 11:52 AM
RE: Using a Proxy Server - by snippsat - Sep-06-2020, 09:52 AM
RE: Using a Proxy Server - by EthanPayne - Sep-13-2020, 02:54 PM
RE: Using a Proxy Server - by EthanPayne - Sep-14-2020, 11:17 AM
RE: Using a Proxy Server - by mikekane - Jan-07-2021, 11:37 AM
RE: Using a Proxy Server - by KaithlynMoore - Feb-10-2021, 10:44 AM
RE: Using a Proxy Server - by KarenBrumit - Jul-22-2021, 12:19 PM
RE: Using a Proxy Server - by lucasbrown - Jan-27-2021, 06:48 PM
RE: Using a Proxy Server - by AlluminumFoil - Dec-04-2023, 06:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Proxy Variable in Selenium wont work with FireFox Profile Proxy Setting. MIPython 0 8,531 Jul-13-2018, 05:43 PM
Last Post: MIPython

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020