By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,772 Members | 919 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,772 IT Pros & Developers. It's quick & easy.

How to download web page using python code?

P: 2
Hi all, I am new bee in Python programming...
I am trying to download web page using python code

import urllib

# Get a file-like object for the Python Web site's home page.

f = urllib.urlopen("")

# Read from the object, storing the page's contents in 's'.

s =


and ERROR is
Traceback (most recent call last):
File "C:\Python26\", line 5, in <module>
f = urllib.urlopen("")
File "C:\Python26\lib\", line 87, in urlopen
File "C:\Python26\lib\", line 203, in open
return getattr(self, name)(url)
File "C:\Python26\lib\", line 338, in open_http
File "C:\Python26\lib\", line 868, in endheaders
File "C:\Python26\lib\", line 740, in _send_output
File "C:\Python26\lib\", line 699, in send
File "C:\Python26\lib\", line 683, in connect
File "C:\Python26\lib\", line 498, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
IOError: [Errno socket error] [Errno 11001] getaddrinfo failed

Please let me know how it is comming....
Thank you well in advance.....
Dec 2 '10 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 621
It works fine for me. Perhaps there is a firewall or some other impediment that must be traversed.
Dec 2 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.