summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorFacundo Batista <facundobatista@gmail.com>2007-06-06 17:15:23 (GMT)
committerFacundo Batista <facundobatista@gmail.com>2007-06-06 17:15:23 (GMT)
commit10951d51e27f52ab5b92748b459a5fd40da6b871 (patch)
tree227688e2502f1de358e5939c7626d0a9dfba3598 /Doc
parent92493120209565d6db37fe97c5bdb2f14d6a9c25 (diff)
downloadcpython-10951d51e27f52ab5b92748b459a5fd40da6b871.zip
cpython-10951d51e27f52ab5b92748b459a5fd40da6b871.tar.gz
cpython-10951d51e27f52ab5b92748b459a5fd40da6b871.tar.bz2
Added an optional timeout parameter to function urllib2.urlopen,
with tests in test_urllib2net.py (must have network resource enabled to execute them). Also modified test_urllib2.py because testing mock classes must take it into acount. Docs are also updated.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/liburllib2.tex16
1 files changed, 13 insertions, 3 deletions
diff --git a/Doc/lib/liburllib2.tex b/Doc/lib/liburllib2.tex
index 0df7385..5547b15 100644
--- a/Doc/lib/liburllib2.tex
+++ b/Doc/lib/liburllib2.tex
@@ -14,7 +14,7 @@ authentication, redirections, cookies and more.
The \module{urllib2} module defines the following functions:
-\begin{funcdesc}{urlopen}{url\optional{, data}}
+\begin{funcdesc}{urlopen}{url\optional{, data}\optional{, timeout}}
Open the URL \var{url}, which can be either a string or a \class{Request}
object.
@@ -27,6 +27,11 @@ parameter is provided. \var{data} should be a buffer in the standard
\function{urllib.urlencode()} function takes a mapping or sequence of
2-tuples and returns a string in this format.
+The optional \var{timeout} parameter specifies a timeout in seconds for the
+connection attempt (if not specified, or passed as None, the global default
+timeout setting will be used). This actually only work for HTTP, HTTPS, FTP
+and FTPS connections.
+
This function returns a file-like object with two additional methods:
\begin{itemize}
@@ -351,12 +356,17 @@ that HTTP errors are a special case).
\end{itemize}
\end{methoddesc}
-\begin{methoddesc}[OpenerDirector]{open}{url\optional{, data}}
+\begin{methoddesc}[OpenerDirector]{open}{url\optional{, data}{\optional{, timeout}}}
Open the given \var{url} (which can be a request object or a string),
optionally passing the given \var{data}.
Arguments, return values and exceptions raised are the same as those
of \function{urlopen()} (which simply calls the \method{open()} method
-on the currently installed global \class{OpenerDirector}).
+on the currently installed global \class{OpenerDirector}). The optional
+\var{timeout} parameter specifies a timeout in seconds for the connection
+attempt (if not specified, or passed as None, the global default timeout
+setting will be used; this actually only work for HTTP, HTTPS, FTP
+and FTPS connections).
+
\end{methoddesc}
\begin{methoddesc}[OpenerDirector]{error}{proto\optional{,