@@ -295,15 +295,15 @@ Utility functions
295
295
If both lowercase and uppercase environment variables exist (and disagree),
296
296
lowercase is preferred.
297
297
298
- .. note ::
298
+ .. note ::
299
299
300
- If the environment variable ``REQUEST_METHOD `` is set, which usually
301
- indicates your script is running in a CGI environment, the environment
302
- variable ``HTTP_PROXY `` (uppercase ``_PROXY ``) will be ignored. This is
303
- because that variable can be injected by a client using the "Proxy:"
304
- HTTP header. If you need to use an HTTP proxy in a CGI environment,
305
- either use ``ProxyHandler `` explicitly, or make sure the variable name
306
- is in lowercase (or at least the ``_proxy `` suffix).
300
+ If the environment variable ``REQUEST_METHOD `` is set, which usually
301
+ indicates your script is running in a CGI environment, the environment
302
+ variable ``HTTP_PROXY `` (uppercase ``_PROXY ``) will be ignored. This is
303
+ because that variable can be injected by a client using the "Proxy:" HTTP
304
+ header. If you need to use an HTTP proxy in a CGI environment, either use
305
+ ``ProxyHandler `` explicitly, or make sure the variable name is in
306
+ lowercase (or at least the ``_proxy `` suffix).
307
307
308
308
.. note ::
309
309
urllib also exposes certain utility functions like splittype, splithost and
@@ -344,47 +344,47 @@ URL Opener objects
344
344
:class: `URLopener ` objects will raise an :exc: `IOError ` exception if the server
345
345
returns an error code.
346
346
347
- .. method :: open(fullurl[, data])
347
+ .. method :: open(fullurl[, data])
348
348
349
- Open *fullurl * using the appropriate protocol. This method sets up cache and
350
- proxy information, then calls the appropriate open method with its input
351
- arguments. If the scheme is not recognized, :meth: `open_unknown ` is called.
352
- The *data * argument has the same meaning as the *data * argument of
353
- :func: `urlopen `.
349
+ Open *fullurl * using the appropriate protocol. This method sets up cache and
350
+ proxy information, then calls the appropriate open method with its input
351
+ arguments. If the scheme is not recognized, :meth: `open_unknown ` is called.
352
+ The *data * argument has the same meaning as the *data * argument of
353
+ :func: `urlopen `.
354
354
355
355
356
- .. method :: open_unknown(fullurl[, data])
356
+ .. method :: open_unknown(fullurl[, data])
357
357
358
- Overridable interface to open unknown URL types.
358
+ Overridable interface to open unknown URL types.
359
359
360
360
361
- .. method :: retrieve(url[, filename[, reporthook[, data]]])
361
+ .. method :: retrieve(url[, filename[, reporthook[, data]]])
362
362
363
- Retrieves the contents of *url * and places it in *filename *. The return value
364
- is a tuple consisting of a local filename and either a
365
- :class: `mimetools.Message ` object containing the response headers (for remote
366
- URLs) or ``None `` (for local URLs). The caller must then open and read the
367
- contents of *filename *. If *filename * is not given and the URL refers to a
368
- local file, the input filename is returned. If the URL is non-local and
369
- *filename * is not given, the filename is the output of :func: `tempfile.mktemp `
370
- with a suffix that matches the suffix of the last path component of the input
371
- URL. If *reporthook * is given, it must be a function accepting three numeric
372
- parameters. It will be called after each chunk of data is read from the
373
- network. *reporthook * is ignored for local URLs.
363
+ Retrieves the contents of *url * and places it in *filename *. The return value
364
+ is a tuple consisting of a local filename and either a
365
+ :class: `mimetools.Message ` object containing the response headers (for remote
366
+ URLs) or ``None `` (for local URLs). The caller must then open and read the
367
+ contents of *filename *. If *filename * is not given and the URL refers to a
368
+ local file, the input filename is returned. If the URL is non-local and
369
+ *filename * is not given, the filename is the output of :func: `tempfile.mktemp `
370
+ with a suffix that matches the suffix of the last path component of the input
371
+ URL. If *reporthook * is given, it must be a function accepting three numeric
372
+ parameters. It will be called after each chunk of data is read from the
373
+ network. *reporthook * is ignored for local URLs.
374
374
375
- If the *url * uses the :file: `http: ` scheme identifier, the optional *data *
376
- argument may be given to specify a ``POST `` request (normally the request type
377
- is ``GET ``). The *data * argument must in standard
378
- :mimetype: `application/x-www-form-urlencoded ` format; see the :func: `urlencode `
379
- function below.
375
+ If the *url * uses the :file: `http: ` scheme identifier, the optional *data *
376
+ argument may be given to specify a ``POST `` request (normally the request type
377
+ is ``GET ``). The *data * argument must in standard
378
+ :mimetype: `application/x-www-form-urlencoded ` format; see the :func: `urlencode `
379
+ function below.
380
380
381
381
382
- .. attribute :: version
382
+ .. attribute :: version
383
383
384
- Variable that specifies the user agent of the opener object. To get
385
- :mod: `urllib ` to tell servers that it is a particular user agent, set this in a
386
- subclass as a class variable or in the constructor before calling the base
387
- constructor.
384
+ Variable that specifies the user agent of the opener object. To get
385
+ :mod: `urllib ` to tell servers that it is a particular user agent, set this in a
386
+ subclass as a class variable or in the constructor before calling the base
387
+ constructor.
388
388
389
389
390
390
.. class :: FancyURLopener(...)
0 commit comments