Obtain Web Page : Web Client « Network « Python






Obtain Web Page

import sys, urllib2

req = urllib2.Request(sys.argv[1])
fd = urllib2.urlopen(req)
while 1:
    data = fd.read(1024)
    if not len(data):
        break
    sys.stdout.write(data)

           
       








Related examples in the same category

1.Obtain Web Page With Full Error Handling
2.Obtain Web Page Information With Simple Error Handling
3.Obtain Web Page Information With Error Document Handling
4.Submit GET Data
5.Basic Connection ExampleBasic Connection Example