@@ -37,10 +37,17 @@ \section{\module{urllib} ---
37
37
required.)
38
38
39
39
The \method {info()} method returns an instance of the class
40
- \class {mimetools.Message} containing the headers received from the
41
- server, if the protocol uses such headers (currently the only
42
- supported protocol that uses this is HTTP). See the description of
43
- the \module {mimetools}\refstmodindex {mimetools} module.
40
+ \class {mimetools.Message} containing meta-information associated
41
+ with the URL. When the method is HTTP, these headers are those
42
+ returned by the server at the head of the retrieved HTML page
43
+ (including Content-Length and Content-Type). When the method is FTP,
44
+ a Content-Length header will be present if (as is now usual) the
45
+ server passed back a file length in response to the FTP retrieval
46
+ request. When the method is local-file, returned headers will include
47
+ a Date representing the file's last-modified time, a Content-Length
48
+ giving file size, and a Content-Type containing a guess at the file's
49
+ type. See also the description of the
50
+ \module {mimetools}\refstmodindex {mimetools} module.
44
51
45
52
If the \var {url} uses the \file {http:} scheme identifier, the optional
46
53
\var {data} argument may be given to specify a \code {POST} request
@@ -50,7 +57,7 @@ \section{\module{urllib} ---
50
57
51
58
\end {funcdesc }
52
59
53
- \begin {funcdesc }{urlretrieve}{url}
60
+ \begin {funcdesc }{urlretrieve}{url\optional {, filename} \optional {, hook}} }
54
61
Copy a network object denoted by a URL to a local file, if necessary.
55
62
If the URL points to a local file, or a valid cached copy of the
56
63
object exists, the object is not copied. Return a tuple
@@ -60,6 +67,16 @@ \section{\module{urllib} ---
60
67
\method {info()} method of the object returned by \function {urlopen()}
61
68
returned (for a remote object, possibly cached). Exceptions are the
62
69
same as for \function {urlopen()}.
70
+
71
+ The second argument, if present, specifies the file location to copy
72
+ to (if absent, the location will be a tempfile with a generated name).
73
+ The third argument, if present, is a hook function that will be called
74
+ once on establishment of the network connection and once after each
75
+ block read thereafter. The hook will be passed three arguments; a
76
+ count of blocks transferred so far, a block size in bytes, and the
77
+ total size of the file. The third argument may be -1 on older FTP
78
+ servers which do not return a file size in response to a retrieval
79
+ request.
63
80
\end {funcdesc }
64
81
65
82
\begin {funcdesc }{urlcleanup}{}
0 commit comments