Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5a2da3b

Browse files
committed
Use proper variable name 'data' instead of 'str' in the send method.
1 parent 7cafd26 commit 5a2da3b

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

Lib/http/client.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -730,23 +730,23 @@ def close(self):
730730
self.__response = None
731731
self.__state = _CS_IDLE
732732

733-
def send(self, str):
734-
"""Send `str' to the server."""
733+
def send(self, data):
734+
"""Send `data' to the server."""
735735
if self.sock is None:
736736
if self.auto_open:
737737
self.connect()
738738
else:
739739
raise NotConnected()
740740

741741
if self.debuglevel > 0:
742-
print("send:", repr(str))
742+
print("send:", repr(data))
743743
blocksize = 8192
744-
if hasattr(str, "read") :
744+
if hasattr(data, "read") :
745745
if self.debuglevel > 0:
746746
print("sendIng a read()able")
747747
encode = False
748748
try:
749-
mode = str.mode
749+
mode = data.mode
750750
except AttributeError:
751751
# io.BytesIO and other file-like objects don't have a `mode`
752752
# attribute.
@@ -757,14 +757,14 @@ def send(self, str):
757757
if self.debuglevel > 0:
758758
print("encoding file using iso-8859-1")
759759
while 1:
760-
data = str.read(blocksize)
761-
if not data:
760+
datablock = data.read(blocksize)
761+
if not datablock:
762762
break
763763
if encode:
764-
data = data.encode("iso-8859-1")
765-
self.sock.sendall(data)
764+
datablock = datablock.encode("iso-8859-1")
765+
self.sock.sendall(datablock)
766766
else:
767-
self.sock.sendall(str)
767+
self.sock.sendall(data)
768768

769769
def _output(self, s):
770770
"""Add a line of output to the current request buffer.

0 commit comments

Comments
 (0)