@@ -78,7 +78,7 @@ The :mod:`urllib.request` module defines the following functions:
78
78
:class: `UnknownHandler ` to ensure this never happens).
79
79
80
80
In addition, if proxy settings are detected (for example, when a ``*_proxy ``
81
- environment variable like :envvar: `http_proxy ` is set),
81
+ environment variable like :envvar: `! http_proxy ` is set),
82
82
:class: `ProxyHandler ` is default installed and makes sure the requests are
83
83
handled through the proxy.
84
84
@@ -113,7 +113,7 @@ The :mod:`urllib.request` module defines the following functions:
113
113
.. versionchanged :: 3.10
114
114
HTTPS connection now send an ALPN extension with protocol indicator
115
115
``http/1.1 `` when no *context * is given. Custom *context * should set
116
- ALPN protocols with :meth: `~ssl.SSLContext.set_alpn_protocol `.
116
+ ALPN protocols with :meth: `~ssl.SSLContext.set_alpn_protocols `.
117
117
118
118
.. versionchanged :: 3.13
119
119
Remove *cafile *, *capath * and *cadefault * parameters: use the *context *
@@ -618,25 +618,25 @@ OpenerDirector Objects
618
618
the actual HTTP code, for example :meth: `http_error_404 ` would handle HTTP
619
619
404 errors.
620
620
621
- * :meth: `<protocol>_open ` --- signal that the handler knows how to open *protocol *
621
+ * :meth: `! <protocol>_open ` --- signal that the handler knows how to open *protocol *
622
622
URLs.
623
623
624
624
See |protocol_open |_ for more information.
625
625
626
- * :meth: `http_error_\< type\> ` --- signal that the handler knows how to handle HTTP
626
+ * :meth: `! http_error_\< type\> ` --- signal that the handler knows how to handle HTTP
627
627
errors with HTTP error code *type *.
628
628
629
629
See |http_error_nnn |_ for more information.
630
630
631
- * :meth: `<protocol>_error ` --- signal that the handler knows how to handle errors
631
+ * :meth: `! <protocol>_error ` --- signal that the handler knows how to handle errors
632
632
from (non-\ ``http ``) *protocol *.
633
633
634
- * :meth: `<protocol>_request ` --- signal that the handler knows how to pre-process
634
+ * :meth: `! <protocol>_request ` --- signal that the handler knows how to pre-process
635
635
*protocol * requests.
636
636
637
637
See |protocol_request |_ for more information.
638
638
639
- * :meth: `<protocol>_response ` --- signal that the handler knows how to
639
+ * :meth: `! <protocol>_response ` --- signal that the handler knows how to
640
640
post-process *protocol * responses.
641
641
642
642
See |protocol_response |_ for more information.
@@ -663,7 +663,7 @@ OpenerDirector Objects
663
663
Handle an error of the given protocol. This will call the registered error
664
664
handlers for the given protocol with the given arguments (which are protocol
665
665
specific). The HTTP protocol is a special case which uses the HTTP response
666
- code to determine the specific error handler; refer to the :meth: `http_error_\< type\> `
666
+ code to determine the specific error handler; refer to the :meth: `! http_error_\< type\> `
667
667
methods of the handler classes.
668
668
669
669
Return values and exceptions raised are the same as those of :func: `urlopen `.
@@ -673,25 +673,25 @@ OpenerDirector objects open URLs in three stages:
673
673
The order in which these methods are called within each stage is determined by
674
674
sorting the handler instances.
675
675
676
- #. Every handler with a method named like :meth: `<protocol>_request ` has that
676
+ #. Every handler with a method named like :meth: `! <protocol>_request ` has that
677
677
method called to pre-process the request.
678
678
679
- #. Handlers with a method named like :meth: `<protocol>_open ` are called to handle
679
+ #. Handlers with a method named like :meth: `! <protocol>_open ` are called to handle
680
680
the request. This stage ends when a handler either returns a non-\ :const: `None `
681
681
value (ie. a response), or raises an exception (usually
682
682
:exc: `~urllib.error.URLError `). Exceptions are allowed to propagate.
683
683
684
684
In fact, the above algorithm is first tried for methods named
685
- :meth: `default_open `. If all such methods return :const: `None `, the algorithm
686
- is repeated for methods named like :meth: `<protocol>_open `. If all such methods
685
+ :meth: `~BaseHandler. default_open `. If all such methods return :const: `None `, the algorithm
686
+ is repeated for methods named like :meth: `! <protocol>_open `. If all such methods
687
687
return :const: `None `, the algorithm is repeated for methods named
688
- :meth: `unknown_open `.
688
+ :meth: `~BaseHandler. unknown_open `.
689
689
690
690
Note that the implementation of these methods may involve calls of the parent
691
691
:class: `OpenerDirector ` instance's :meth: `~OpenerDirector.open ` and
692
692
:meth: `~OpenerDirector.error ` methods.
693
693
694
- #. Every handler with a method named like :meth: `<protocol>_response ` has that
694
+ #. Every handler with a method named like :meth: `! <protocol>_response ` has that
695
695
method called to post-process the response.
696
696
697
697
@@ -740,7 +740,7 @@ The following attribute and methods should only be used by classes derived from
740
740
the return value of the :meth: `~OpenerDirector.open ` method of :class: `OpenerDirector `, or ``None ``.
741
741
It should raise :exc: `~urllib.error.URLError `, unless a truly exceptional
742
742
thing happens (for example, :exc: `MemoryError ` should not be mapped to
743
- :exc: `URLError `).
743
+ :exc: `~urllib.error. URLError `).
744
744
745
745
This method will be called before any protocol-specific open method.
746
746
@@ -753,7 +753,7 @@ The following attribute and methods should only be used by classes derived from
753
753
define it if they want to handle URLs with the given protocol.
754
754
755
755
This method, if defined, will be called by the parent :class: `OpenerDirector `.
756
- Return values should be the same as for :meth: `default_open `.
756
+ Return values should be the same as for :meth: `~BaseHandler. default_open `.
757
757
758
758
759
759
.. method :: BaseHandler.unknown_open(req)
@@ -793,7 +793,7 @@ The following attribute and methods should only be used by classes derived from
793
793
Subclasses should override this method to handle specific HTTP errors.
794
794
795
795
Arguments, return values and exceptions raised should be the same as for
796
- :meth: `http_error_default `.
796
+ :meth: `~BaseHandler. http_error_default `.
797
797
798
798
799
799
.. _protocol_request :
@@ -833,7 +833,7 @@ HTTPRedirectHandler Objects
833
833
is the case, :exc: `~urllib.error.HTTPError ` is raised. See :rfc: `2616 ` for
834
834
details of the precise meanings of the various redirection codes.
835
835
836
- An :class: ` HTTPError ` exception raised as a security consideration if the
836
+ An :exc: ` ~urllib.error. HTTPError ` exception raised as a security consideration if the
837
837
HTTPRedirectHandler is presented with a redirected URL which is not an HTTP,
838
838
HTTPS or FTP URL.
839
839
@@ -910,7 +910,7 @@ ProxyHandler Objects
910
910
.. method :: ProxyHandler.<protocol>_open(request)
911
911
:noindex:
912
912
913
- The :class: `ProxyHandler ` will have a method :meth: `<protocol>_open ` for every
913
+ The :class: `ProxyHandler ` will have a method :meth: `! <protocol>_open ` for every
914
914
*protocol * which has a proxy in the *proxies * dictionary given in the
915
915
constructor. The method will modify requests to go through the proxy, by
916
916
calling ``request.set_proxy() ``, and call the next handler in the chain to
@@ -1166,7 +1166,7 @@ HTTPErrorProcessor Objects
1166
1166
For 200 error codes, the response object is returned immediately.
1167
1167
1168
1168
For non-200 error codes, this simply passes the job on to the
1169
- :meth: `http_error_\< type\> ` handler methods, via :meth: `OpenerDirector.error `.
1169
+ :meth: `! http_error_\< type\> ` handler methods, via :meth: `OpenerDirector.error `.
1170
1170
Eventually, :class: `HTTPDefaultErrorHandler ` will raise an
1171
1171
:exc: `~urllib.error.HTTPError ` if no other handler handles the error.
1172
1172
@@ -1273,7 +1273,7 @@ Use of Basic HTTP Authentication::
1273
1273
:func: `build_opener ` provides many handlers by default, including a
1274
1274
:class: `ProxyHandler `. By default, :class: `ProxyHandler ` uses the environment
1275
1275
variables named ``<scheme>_proxy ``, where ``<scheme> `` is the URL scheme
1276
- involved. For example, the :envvar: `http_proxy ` environment variable is read to
1276
+ involved. For example, the :envvar: `! http_proxy ` environment variable is read to
1277
1277
obtain the HTTP proxy's URL.
1278
1278
1279
1279
This example replaces the default :class: `ProxyHandler ` with one that uses
@@ -1368,7 +1368,7 @@ some point in the future.
1368
1368
points to a local file, the object will not be copied unless filename is supplied.
1369
1369
Return a tuple ``(filename, headers) `` where *filename * is the
1370
1370
local file name under which the object can be found, and *headers * is whatever
1371
- the :meth: `info ` method of the object returned by :func: `urlopen ` returned (for
1371
+ the :meth: `! info ` method of the object returned by :func: `urlopen ` returned (for
1372
1372
a remote object). Exceptions are the same as for :func: `urlopen `.
1373
1373
1374
1374
The second argument, if present, specifies the file location to copy to (if
@@ -1393,7 +1393,7 @@ some point in the future.
1393
1393
:mimetype: `application/x-www-form-urlencoded ` format; see the
1394
1394
:func: `urllib.parse.urlencode ` function.
1395
1395
1396
- :func: `urlretrieve ` will raise :exc: `ContentTooShortError ` when it detects that
1396
+ :func: `urlretrieve ` will raise :exc: `~urllib.error. ContentTooShortError ` when it detects that
1397
1397
the amount of data available was less than the expected amount (which is the
1398
1398
size reported by a *Content-Length * header). This can occur, for example, when
1399
1399
the download is interrupted.
@@ -1402,8 +1402,8 @@ some point in the future.
1402
1402
urlretrieve reads more data, but if less data is available, it raises the
1403
1403
exception.
1404
1404
1405
- You can still retrieve the downloaded data in this case, it is stored in the
1406
- :attr: `content ` attribute of the exception instance.
1405
+ You can still retrieve the downloaded data in this case, it is stored in the
1406
+ :attr: `! content ` attribute of the exception instance.
1407
1407
1408
1408
If no *Content-Length * header was supplied, urlretrieve can not check the size
1409
1409
of the data it has downloaded, and just returns it. In this case you just have
@@ -1497,7 +1497,7 @@ some point in the future.
1497
1497
authentication is performed. For the 30x response codes, recursion is bounded
1498
1498
by the value of the *maxtries * attribute, which defaults to 10.
1499
1499
1500
- For all other response codes, the method :meth: `http_error_default ` is called
1500
+ For all other response codes, the method :meth: `~BaseHandler. http_error_default ` is called
1501
1501
which you can override in subclasses to handle the error appropriately.
1502
1502
1503
1503
.. note ::
0 commit comments