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

Skip to content

Commit 47f11ce

Browse files
committed
Added warning that FancyURLopener prompts the user on the terminal when
basic authentication is needed. Added documentation for FancyURLopener.prompt_user_passwd(), explaining that subclasses should provide more appropriate behavior for the hosting environment.
1 parent 614e87f commit 47f11ce

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Doc/lib/liburllib.tex

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,13 @@ \section{\module{urllib} ---
211211

212212
The parameters to the constructor are the same as those for
213213
\class{URLopener}.
214+
215+
\strong{Note:} When performing basic authentication, a
216+
\class{FancyURLopener} instance calls its
217+
\method{prompt_user_passwd()} method. The default implementation asks
218+
the users for the required information on the controlling terminal. A
219+
subclass may override this method to support more appropriate behavior
220+
if needed.
214221
\end{classdesc}
215222

216223
Restrictions:
@@ -315,6 +322,20 @@ \subsection{URLopener Objects \label{urlopener-objs}}
315322
before calling the base constructor.
316323
\end{memberdesc}
317324

325+
The \class{FancyURLopener} class offers one additional method that
326+
should be overloaded to provide the appropriate behavior:
327+
328+
\begin{methoddesc}[FancyURLopener]{prompt_user_passwd}{host, realm}
329+
Return information needed to authenticate the user at the given host
330+
in the specified security realm. The return value should be a tuple,
331+
\code{(\var{user}, \var{password})}, which can be used for basic
332+
authentication.
333+
334+
The implementation prompts for this information on the terminal; an
335+
application should override this method to use an appropriate
336+
interaction model in the local environment.
337+
\end{methoddesc}
338+
318339

319340
\subsection{Examples}
320341
\nodename{Urllib Examples}

0 commit comments

Comments
 (0)