Use of httplib?
DavidL at nospammy_raqia.com
Wed Dec 13 22:04:22 CET 2000
I am running the client code below to try and send and receive text from
a server. My problem is that I do not know how to recieve back an
arbitrary number of lines. In a test case, when I know the exact number
of lines as shown below (e.g. 11) I can use readline. However, in
general I do not know how many lines there are and the program hangs on
the connection when I accidentaly read to the end. The comment out
pieces of code also either hang or do not give back all the text.
I am copying from the Library Reference section 11.4, but it does not
seem to document the readline, read or readlines methods for http.
Thanks in advance for any help/pointers.
h = httplib.HTTP("192.168.0.3:50006")
h.putheader("Content-length", "%d" % len(bod))
reply, msg, hdrs = h.getreply()
f = h.getfile()
for i in range(11):
# if not data:
# print data
More information about the Python-list