mirror of https://github.com/python/cpython.git
Some nits.
This commit is contained in:
parent
51b7abc519
commit
f03facfe90
|
@ -32,12 +32,11 @@ An \class{HTTPConnection} instance represents one transaction with an HTTP
|
||||||
server. It should be instantiated passing it a host and optional port number.
|
server. It should be instantiated passing it a host and optional port number.
|
||||||
If no port number is passed, the port is extracted from the host string if it
|
If no port number is passed, the port is extracted from the host string if it
|
||||||
has the form \code{\var{host}:\var{port}}, else the default HTTP port (80) is
|
has the form \code{\var{host}:\var{port}}, else the default HTTP port (80) is
|
||||||
used.
|
used. When True, the optional parameter \var{strict}
|
||||||
When True the optional parameter \var{strict}
|
|
||||||
causes \code{BadStatusLine} to be raised if the status line can't be parsed
|
causes \code{BadStatusLine} to be raised if the status line can't be parsed
|
||||||
as a valid HTTP/1.0 or 1.1 status line. If the optional \var{timeout}
|
as a valid HTTP/1.0 or 1.1 status line. If the optional \var{timeout}
|
||||||
parameter is given, connection attempts will timeout after that many
|
parameter is given, connection attempts will timeout after that many
|
||||||
seconds (if no timeout is passed, or is passed as None, the global default
|
seconds (if it is not given or \code{None}, the global default
|
||||||
timeout setting is used).
|
timeout setting is used).
|
||||||
|
|
||||||
For example, the following calls all create instances that connect to
|
For example, the following calls all create instances that connect to
|
||||||
|
|
|
@ -171,12 +171,12 @@ supported on this platform.
|
||||||
\end{datadesc}
|
\end{datadesc}
|
||||||
|
|
||||||
\begin{funcdesc}{create_connection}{address\optional{, timeout}}
|
\begin{funcdesc}{create_connection}{address\optional{, timeout}}
|
||||||
Connects to the \var{address} received (as usual, a pair host/port), with
|
Connects to the \var{address} received (as usual, a \code{(host, port)}
|
||||||
an optional timeout for the connection. Specially useful for higher-level
|
pair), with an optional timeout for the connection. Specially useful for
|
||||||
protocols, it is not normally used directly from application-level code.
|
higher-level protocols, it is not normally used directly from
|
||||||
Passing the optional \var{timeout} parameter will set the timeout on the
|
application-level code. Passing the optional \var{timeout} parameter
|
||||||
socket instance (if not present, or passed as None, the global default
|
will set the timeout on the socket instance (if it is not given or
|
||||||
timeout setting is used).
|
\code{None}, the global default timeout setting is used).
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{getaddrinfo}{host, port\optional{, family\optional{,
|
\begin{funcdesc}{getaddrinfo}{host, port\optional{, family\optional{,
|
||||||
|
|
|
@ -659,7 +659,8 @@ def set_debuglevel(self, level):
|
||||||
|
|
||||||
def connect(self):
|
def connect(self):
|
||||||
"""Connect to the host and port specified in __init__."""
|
"""Connect to the host and port specified in __init__."""
|
||||||
self.sock = socket.create_connection((self.host,self.port), self.timeout)
|
self.sock = socket.create_connection((self.host,self.port),
|
||||||
|
self.timeout)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
"""Close the connection to the HTTP server."""
|
"""Close the connection to the HTTP server."""
|
||||||
|
|
Loading…
Reference in New Issue