Using the example below i am trying to get web conents from behind a proxy server but so far am unsuccessful.
proxies = {'http': 'http://proxy:8080'}
from urllib.request import urlopen
with urlopen('http://sixty-north.com/c/t.txt', proxies) as story:
story_words = []
for line in story:
line_words = line.split()
for word in line_words:
story_words.append(word)
story_words
Any idea where I am going wrong? If I remove the proxies argument I get:
[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
If I enter proxies argument I get:
ValueError: Content-Length should be specified for iterable data of type {'http': 'http://proxy:8080'}
Am using PyCharm as the IDE and if I check internet connection from within the PyCharm settings, it succeeds.
Thanks for any suggestion.