@@ -170,15 +170,15 @@ The :mod:`urllib.request` module defines the following functions:
170
170
If both lowercase and uppercase environment variables exist (and disagree),
171
171
lowercase is preferred.
172
172
173
- .. note ::
173
+ .. note ::
174
174
175
- If the environment variable ``REQUEST_METHOD `` is set, which usually
176
- indicates your script is running in a CGI environment, the environment
177
- variable ``HTTP_PROXY `` (uppercase ``_PROXY ``) will be ignored. This is
178
- because that variable can be injected by a client using the "Proxy:" HTTP
179
- header. If you need to use an HTTP proxy in a CGI environment, either use
180
- ``ProxyHandler `` explicitly, or make sure the variable name is in
181
- lowercase (or at least the ``_proxy `` suffix).
175
+ If the environment variable ``REQUEST_METHOD `` is set, which usually
176
+ indicates your script is running in a CGI environment, the environment
177
+ variable ``HTTP_PROXY `` (uppercase ``_PROXY ``) will be ignored. This is
178
+ because that variable can be injected by a client using the "Proxy:" HTTP
179
+ header. If you need to use an HTTP proxy in a CGI environment, either use
180
+ ``ProxyHandler `` explicitly, or make sure the variable name is in
181
+ lowercase (or at least the ``_proxy `` suffix).
182
182
183
183
184
184
The following classes are provided:
@@ -1407,48 +1407,48 @@ some point in the future.
1407
1407
:class: `URLopener ` objects will raise an :exc: `OSError ` exception if the server
1408
1408
returns an error code.
1409
1409
1410
- .. method :: open(fullurl, data=None)
1410
+ .. method :: open(fullurl, data=None)
1411
1411
1412
- Open *fullurl * using the appropriate protocol. This method sets up cache and
1413
- proxy information, then calls the appropriate open method with its input
1414
- arguments. If the scheme is not recognized, :meth: `open_unknown ` is called.
1415
- The *data * argument has the same meaning as the *data * argument of
1416
- :func: `urlopen `.
1412
+ Open *fullurl * using the appropriate protocol. This method sets up cache and
1413
+ proxy information, then calls the appropriate open method with its input
1414
+ arguments. If the scheme is not recognized, :meth: `open_unknown ` is called.
1415
+ The *data * argument has the same meaning as the *data * argument of
1416
+ :func: `urlopen `.
1417
1417
1418
1418
1419
- .. method :: open_unknown(fullurl, data=None)
1419
+ .. method :: open_unknown(fullurl, data=None)
1420
1420
1421
- Overridable interface to open unknown URL types.
1421
+ Overridable interface to open unknown URL types.
1422
1422
1423
1423
1424
- .. method :: retrieve(url, filename=None, reporthook=None, data=None)
1424
+ .. method :: retrieve(url, filename=None, reporthook=None, data=None)
1425
1425
1426
- Retrieves the contents of *url * and places it in *filename *. The return value
1427
- is a tuple consisting of a local filename and either an
1428
- :class: `email.message.Message ` object containing the response headers (for remote
1429
- URLs) or ``None `` (for local URLs). The caller must then open and read the
1430
- contents of *filename *. If *filename * is not given and the URL refers to a
1431
- local file, the input filename is returned. If the URL is non-local and
1432
- *filename * is not given, the filename is the output of :func: `tempfile.mktemp `
1433
- with a suffix that matches the suffix of the last path component of the input
1434
- URL. If *reporthook * is given, it must be a function accepting three numeric
1435
- parameters: A chunk number, the maximum size chunks are read in and the total size of the download
1436
- (-1 if unknown). It will be called once at the start and after each chunk of data is read from the
1437
- network. *reporthook * is ignored for local URLs.
1426
+ Retrieves the contents of *url * and places it in *filename *. The return value
1427
+ is a tuple consisting of a local filename and either an
1428
+ :class: `email.message.Message ` object containing the response headers (for remote
1429
+ URLs) or ``None `` (for local URLs). The caller must then open and read the
1430
+ contents of *filename *. If *filename * is not given and the URL refers to a
1431
+ local file, the input filename is returned. If the URL is non-local and
1432
+ *filename * is not given, the filename is the output of :func: `tempfile.mktemp `
1433
+ with a suffix that matches the suffix of the last path component of the input
1434
+ URL. If *reporthook * is given, it must be a function accepting three numeric
1435
+ parameters: A chunk number, the maximum size chunks are read in and the total size of the download
1436
+ (-1 if unknown). It will be called once at the start and after each chunk of data is read from the
1437
+ network. *reporthook * is ignored for local URLs.
1438
1438
1439
- If the *url * uses the :file: `http: ` scheme identifier, the optional *data *
1440
- argument may be given to specify a ``POST `` request (normally the request type
1441
- is ``GET ``). The *data * argument must in standard
1442
- :mimetype: `application/x-www-form-urlencoded ` format; see the
1443
- :func: `urllib.parse.urlencode ` function.
1439
+ If the *url * uses the :file: `http: ` scheme identifier, the optional *data *
1440
+ argument may be given to specify a ``POST `` request (normally the request type
1441
+ is ``GET ``). The *data * argument must in standard
1442
+ :mimetype: `application/x-www-form-urlencoded ` format; see the
1443
+ :func: `urllib.parse.urlencode ` function.
1444
1444
1445
1445
1446
- .. attribute :: version
1446
+ .. attribute :: version
1447
1447
1448
- Variable that specifies the user agent of the opener object. To get
1449
- :mod: `urllib ` to tell servers that it is a particular user agent, set this in a
1450
- subclass as a class variable or in the constructor before calling the base
1451
- constructor.
1448
+ Variable that specifies the user agent of the opener object. To get
1449
+ :mod: `urllib ` to tell servers that it is a particular user agent, set this in a
1450
+ subclass as a class variable or in the constructor before calling the base
1451
+ constructor.
1452
1452
1453
1453
1454
1454
.. class :: FancyURLopener(...)
0 commit comments