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

Skip to content

Commit 8932b41

Browse files
committed
Patch 851752 (fixes bug 820583)
Patch by John J Lee Reviewed by Jeff Epler / KBK Doc built OK. urlopen() may return None if no handler handles the request. Also clarify what install_opener does. M liburllib2.tex
1 parent d2c5b4b commit 8932b41

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

Doc/lib/liburllib2.tex

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,19 @@ \section{\module{urllib2} ---
3333
\end{itemize}
3434

3535
Raises \exception{URLError} on errors.
36+
37+
Note that \code{None} may be returned if no handler handles the
38+
request (though the default installed global \class{OpenerDirector}
39+
uses \class{UnknownHandler} to ensure this never happens).
3640
\end{funcdesc}
3741

3842
\begin{funcdesc}{install_opener}{opener}
39-
Install an \class{OpenerDirector} instance as the default opener.
40-
The code does not check for a real \class{OpenerDirector}, and any
41-
class with the appropriate interface will work.
43+
Install an \class{OpenerDirector} instance as the default global
44+
opener. Installing an opener is only necessary if you want urlopen to
45+
use that opener; otherwise, simply call \method{OpenerDirector.open()}
46+
instead of \function{urlopen()}. The code does not check for a real
47+
\class{OpenerDirector}, and any class with the appropriate interface
48+
will work.
4249
\end{funcdesc}
4350

4451
\begin{funcdesc}{build_opener}{\optional{handler, \moreargs}}

0 commit comments

Comments
 (0)