code
stringlengths
3
6.57k
self.fp.fileno()
getheader(self, name, default=None)
ResponseNotReady()
self.headers.get_all(name)
isinstance(headers, str)
hasattr(headers, '__iter__')
join(headers)
getheaders(self)
of (header, value)
ResponseNotReady()
list(self.headers.items()
__iter__(self)
info(self)
if (as is now usual)
geturl(self)
urlopen()
geturl()
getcode(self)
_is_textIO(stream)
isinstance(stream, io.TextIOBase)
_get_content_length(body, method)
body (RFC 7230, Section 3.3.2)
method.upper()
hasattr(body, 'read')
protocol (bytes, bytearray, array)
memoryview(body)
isinstance(body, str)
len(body)
self._get_hostport(host, port)
set_tunnel(self, host, port=None, headers=None)
RuntimeError("Can't set up tunnel for established connection")
self._get_hostport(host, port)
self._tunnel_headers.clear()
_get_hostport(self, host, port)
host.rfind(':')
host.rfind(']')
int(host[i+1:])
InvalidURL("nonnumeric port: '%s'" % host[i+1:])
return (host, port)
set_debuglevel(self, level)
_tunnel(self)
connect_str.encode("ascii")
self.send(connect_bytes)
self._tunnel_headers.items()
header_str.encode("latin-1")
self.send(header_bytes)
self.send(b'\r\n')
self.response_class(self.sock, method=self._method)
response._read_status()
self.close()
message.strip()
response.fp.readline(_MAXLINE + 1)
len(line)
LineTooLong("header line")
in (b'\r\n', b'\n', b'')
print('header:', line.decode()
connect(self)
self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
self._tunnel()
close(self)
sock.close()
response.close()
send(self, data)
read()
self.connect()
NotConnected()
print("send:", repr(data)
hasattr(data, "read")
print("sendIng a read()
self._is_textIO(data)
print("encoding file using iso-8859-1")
data.read(self.blocksize)
datablock.encode("iso-8859-1")
self.sock.sendall(datablock)
self.sock.sendall(data)
isinstance(data, collections.abc.Iterable)
self.sock.sendall(d)
type(data)
_output(self, s)
self._buffer.append(s)
_read_readable(self, readable)
print("sendIng a read()
self._is_textIO(readable)
print("encoding file using iso-8859-1")
readable.read(self.blocksize)
datablock.encode("iso-8859-1")
_send_output(self, message_body=None, encode_chunked=False)
self._buffer.extend((b"", b"")
join(self._buffer)
self.send(msg)
hasattr(message_body, 'read')
self._read_readable(message_body)
memoryview(message_body)
iter(message_body)
type(message_body)
print('Zero length chunk ignored')
len(chunk)
encode('ascii')
self.send(chunk)
self.send(b'0\r\n\r\n')