Hugh Chalmers Hugh Chalmers - 1 year ago 124
Python Question

Read text file over internet on python

Here's a text file on the internet (http) How would I print that in Python 2?

People are saying this is a duplicate, I would like to say that it is not a duplicate, any other script I found gave Error 412.

wim wim
Answer Source
>>> from urllib2 import Request, urlopen
>>> url = ''
>>> urlopen(Request(url=url, headers={'User-Agent': "hey, it's wim"})).read()
'Exmaple Text'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download