In HTTPConnection send Type instancemethod Base Class type instancemet

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
In [2]: HTTPConnection.send??
Type: instancemethod
Base Class: <type 'instancemethod'>
String Form: <unbound method HTTPConnection.send>
Namespace: Interactive
File: /usr/lib/python2.5/httplib.py
Definition: HTTPConnection.send(self, str)
Source:
def send(self, str):
"""Send `str' to the server."""
if self.sock is None:
if self.auto_open:
self.connect()
else:
raise NotConnected()
# send the data to the server. if we get a broken pipe, then close
# the socket. we want to reconnect when somebody tries to send again.
#
# 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)
try:
self.sock.sendall(str)
except socket.error, v:
if v[0] == 32: # Broken pipe
self.close()
raise