[Python-checkins] CVS: python/dist/src/Doc/lib liburllib.tex,1.26,1.27
Fred L. Drake
python-dev@python.org
Thu, 24 Aug 2000 22:13:45 -0700
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv2772/lib
Modified Files:
liburllib.tex
Log Message:
Revised documentation relevant to SourceForge patch #100837
(simplify making HTTP POST requests).
Added documentation of URLopener.version and how it can be overridden.
Index: liburllib.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib.tex,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** liburllib.tex 2000/08/24 16:20:32 1.26
--- liburllib.tex 2000/08/25 05:13:42 1.27
***************
*** 1,4 ****
\section{\module{urllib} ---
! Open an arbitrary resource by URL}
\declaremodule{standard}{urllib}
--- 1,4 ----
\section{\module{urllib} ---
! Open arbitrary resources by URL}
\declaremodule{standard}{urllib}
***************
*** 165,174 ****
\end{funcdesc}
! The public functions \function{urlopen()} and \function{urlretrieve()}
! create an instance of the \class{FancyURLopener} class and use it to perform
! their requested actions. To override this functionality, programmers can
! create a subclass of \class{URLopener} or \class{FancyURLopener}, then
! assign that class to the \var{urllib._urlopener} variable before calling the
! desired function. For example, applications may want to specify a different
\code{user-agent} header than \class{URLopener} defines. This can be
accomplished with the following code:
--- 165,176 ----
\end{funcdesc}
! The public functions \function{urlopen()} and
! \function{urlretrieve()} create an instance of the
! \class{FancyURLopener} class and use it to perform their requested
! actions. To override this functionality, programmers can create a
! subclass of \class{URLopener} or \class{FancyURLopener}, then assign
! that an instance of that class to the
! \code{urllib._urlopener} variable before calling the desired function.
! For example, applications may want to specify a different
\code{user-agent} header than \class{URLopener} defines. This can be
accomplished with the following code:
***************
*** 194,198 ****
define their own \code{user-agent} header by subclassing
\class{URLopener} or \class{FancyURLopener} and setting the instance
! attribute \var{version} to an appropriate string value before the
\method{open()} method is called.
--- 196,200 ----
define their own \code{user-agent} header by subclassing
\class{URLopener} or \class{FancyURLopener} and setting the instance
! attribute \member{version} to an appropriate string value before the
\method{open()} method is called.
***************
*** 268,274 ****
\class{URLopener} and \class{FancyURLopener} objects have the
! following methods.
! \begin{methoddesc}{open}{fullurl\optional{, data}}
Open \var{fullurl} using the appropriate protocol. This method sets
up cache and proxy information, then calls the appropriate open method with
--- 270,276 ----
\class{URLopener} and \class{FancyURLopener} objects have the
! following attributes.
! \begin{methoddesc}[URLopener]{open}{fullurl\optional{, data}}
Open \var{fullurl} using the appropriate protocol. This method sets
up cache and proxy information, then calls the appropriate open method with
***************
*** 278,286 ****
\end{methoddesc}
! \begin{methoddesc}{open_unknown}{fullurl\optional{, data}}
Overridable interface to open unknown URL types.
\end{methoddesc}
! \begin{methoddesc}{retrieve}{url\optional{, filename\optional{, reporthook}}}
Retrieves the contents of \var{url} and places it in \var{filename}. The
return value is a tuple consisting of a local filename and either a
--- 280,290 ----
\end{methoddesc}
! \begin{methoddesc}[URLopener]{open_unknown}{fullurl\optional{, data}}
Overridable interface to open unknown URL types.
\end{methoddesc}
! \begin{methoddesc}[URLopener]{retrieve}{url\optional{,
! filename\optional{,
! reporthook\optional{, data}}}}
Retrieves the contents of \var{url} and places it in \var{filename}. The
return value is a tuple consisting of a local filename and either a
***************
*** 302,305 ****
--- 306,316 ----
see the \function{urlencode()} function below.
\end{methoddesc}
+
+ \begin{memberdesc}[URLopener]{version}
+ Variable that specifies the user agent of the opener object. To get
+ \refmodule{urllib} to tell servers that it is a particular user agent,
+ set this in a subclass as a class variable or in the constructor
+ before calling the base constructor.
+ \end{memberdesc}