Why doesn't this work?
Matt Mencel
matt at cmitech.com
Mon Dec 27 16:08:11 EST 1999
When I try and run this code snippet I get this error in the f.read line.
<<ERROR>>
-1
Traceback (innermost last):
File "net.py", line 10, in ?
data = f.read() # Get the raw HTML
TypeError: not enough arguments
<<CODE SNIPPET>>
import httplib
h=httplib.HTTP(www.somewebsite.com)
h.putrequest('GET', '/somepage.html')
h.putheader('Accept', 'text/html')
h.putheader('Accept', 'text/plain')
h.endheaders()
errcode, errmsg, headers = h.getreply()
print errcode # Should be 200
f = h.getfile()
data = f.read() # Get the raw HTML
f.close()
More information about the Python-list
mailing list