summaryrefslogtreecommitdiffstats
path: root/Lib/httplib.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-02-09 05:37:30 (GMT)
committerGuido van Rossum <guido@python.org>2007-02-09 05:37:30 (GMT)
commitbe19ed77ddb047e02fe94d142181062af6d99dcc (patch)
tree70f214e06554046fcccbadeb78665f25e07ce965 /Lib/httplib.py
parent452bf519a70c3db0e7f0d2540b1bfb07d9085583 (diff)
downloadcpython-be19ed77ddb047e02fe94d142181062af6d99dcc.zip
cpython-be19ed77ddb047e02fe94d142181062af6d99dcc.tar.gz
cpython-be19ed77ddb047e02fe94d142181062af6d99dcc.tar.bz2
Fix most trivially-findable print statements.
There's one major and one minor category still unfixed: doctests are the major category (and I hope to be able to augment the refactoring tool to refactor bona fide doctests soon); other code generating print statements in strings is the minor category. (Oh, and I don't know if the compiler package works.)
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r--Lib/httplib.py42
1 files changed, 21 insertions, 21 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py
index ca6e1d0..2507530 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -342,7 +342,7 @@ class HTTPResponse:
# Initialize with Simple-Response defaults
line = self.fp.readline()
if self.debuglevel > 0:
- print "reply:", repr(line)
+ print("reply:", repr(line))
if not line:
# Presumably, the server closed the connection before
# sending a valid response.
@@ -391,7 +391,7 @@ class HTTPResponse:
if not skip:
break
if self.debuglevel > 0:
- print "header:", skip
+ print("header:", skip)
self.status = status
self.reason = reason.strip()
@@ -414,7 +414,7 @@ class HTTPResponse:
self.msg = HTTPMessage(self.fp, 0)
if self.debuglevel > 0:
for hdr in self.msg.headers:
- print "header:", hdr,
+ print("header:", hdr, end=' ')
# don't let the msg keep an fp
self.msg.fp = None
@@ -665,11 +665,11 @@ class HTTPConnection:
try:
self.sock = socket.socket(af, socktype, proto)
if self.debuglevel > 0:
- print "connect: (%s, %s)" % (self.host, self.port)
+ print("connect: (%s, %s)" % (self.host, self.port))
self.sock.connect(sa)
except socket.error as msg:
if self.debuglevel > 0:
- print 'connect fail:', (self.host, self.port)
+ print('connect fail:', (self.host, self.port))
if self.sock:
self.sock.close()
self.sock = None
@@ -702,11 +702,11 @@ class HTTPConnection:
# NOTE: we DO propagate the error, though, because we cannot simply
# ignore the error... the caller will know if they can retry.
if self.debuglevel > 0:
- print "send:", repr(str)
+ print("send:", repr(str))
try:
blocksize=8192
if hasattr(str,'read') :
- if self.debuglevel > 0: print "sendIng a read()able"
+ if self.debuglevel > 0: print("sendIng a read()able")
data=str.read(blocksize)
while data:
self.sock.sendall(data)
@@ -898,7 +898,7 @@ class HTTPConnection:
thelen = str(os.fstat(body.fileno()).st_size)
except (AttributeError, OSError):
# Don't send a length if this failed
- if self.debuglevel > 0: print "Cannot stat!!"
+ if self.debuglevel > 0: print("Cannot stat!!")
if thelen is not None:
self.putheader('Content-Length',thelen)
@@ -1408,13 +1408,13 @@ def test():
h.putrequest('GET', selector)
h.endheaders()
status, reason, headers = h.getreply()
- print 'status =', status
- print 'reason =', reason
- print "read", len(h.getfile().read())
- print
+ print('status =', status)
+ print('reason =', reason)
+ print("read", len(h.getfile().read()))
+ print()
if headers:
- for header in headers.headers: print header.strip()
- print
+ for header in headers.headers: print(header.strip())
+ print()
# minimal test that code to extract host from url works
class HTTP11(HTTP):
@@ -1431,20 +1431,20 @@ def test():
for host, selector in (('sourceforge.net', '/projects/python'),
):
- print "https://%s%s" % (host, selector)
+ print("https://%s%s" % (host, selector))
hs = HTTPS()
hs.set_debuglevel(dl)
hs.connect(host)
hs.putrequest('GET', selector)
hs.endheaders()
status, reason, headers = hs.getreply()
- print 'status =', status
- print 'reason =', reason
- print "read", len(hs.getfile().read())
- print
+ print('status =', status)
+ print('reason =', reason)
+ print("read", len(hs.getfile().read()))
+ print()
if headers:
- for header in headers.headers: print header.strip()
- print
+ for header in headers.headers: print(header.strip())
+ print()
if __name__ == '__main__':
test()