@@ -86,7 +86,7 @@ The :mod:`urllib.request` module defines the following functions:
86
86
:class: `UnknownHandler ` to ensure this never happens).
87
87
88
88
In addition, if proxy settings are detected (for example, when a ``*_proxy ``
89
- environment variable like :envvar: `http_proxy ` is set),
89
+ environment variable like :envvar: `! http_proxy ` is set),
90
90
:class: `ProxyHandler ` is default installed and makes sure the requests are
91
91
handled through the proxy.
92
92
@@ -121,7 +121,7 @@ The :mod:`urllib.request` module defines the following functions:
121
121
.. versionchanged :: 3.10
122
122
HTTPS connection now send an ALPN extension with protocol indicator
123
123
``http/1.1 `` when no *context * is given. Custom *context * should set
124
- ALPN protocols with :meth: `~ssl.SSLContext.set_alpn_protocol `.
124
+ ALPN protocols with :meth: `~ssl.SSLContext.set_alpn_protocols `.
125
125
126
126
.. deprecated :: 3.6
127
127
@@ -629,25 +629,25 @@ OpenerDirector Objects
629
629
the actual HTTP code, for example :meth: `http_error_404 ` would handle HTTP
630
630
404 errors.
631
631
632
- * :meth: `<protocol>_open ` --- signal that the handler knows how to open *protocol *
632
+ * :meth: `! <protocol>_open ` --- signal that the handler knows how to open *protocol *
633
633
URLs.
634
634
635
635
See |protocol_open |_ for more information.
636
636
637
- * :meth: `http_error_\< type\> ` --- signal that the handler knows how to handle HTTP
637
+ * :meth: `! http_error_\< type\> ` --- signal that the handler knows how to handle HTTP
638
638
errors with HTTP error code *type *.
639
639
640
640
See |http_error_nnn |_ for more information.
641
641
642
- * :meth: `<protocol>_error ` --- signal that the handler knows how to handle errors
642
+ * :meth: `! <protocol>_error ` --- signal that the handler knows how to handle errors
643
643
from (non-\ ``http ``) *protocol *.
644
644
645
- * :meth: `<protocol>_request ` --- signal that the handler knows how to pre-process
645
+ * :meth: `! <protocol>_request ` --- signal that the handler knows how to pre-process
646
646
*protocol * requests.
647
647
648
648
See |protocol_request |_ for more information.
649
649
650
- * :meth: `<protocol>_response ` --- signal that the handler knows how to
650
+ * :meth: `! <protocol>_response ` --- signal that the handler knows how to
651
651
post-process *protocol * responses.
652
652
653
653
See |protocol_response |_ for more information.
@@ -674,7 +674,7 @@ OpenerDirector Objects
674
674
Handle an error of the given protocol. This will call the registered error
675
675
handlers for the given protocol with the given arguments (which are protocol
676
676
specific). The HTTP protocol is a special case which uses the HTTP response
677
- code to determine the specific error handler; refer to the :meth: `http_error_\< type\> `
677
+ code to determine the specific error handler; refer to the :meth: `! http_error_\< type\> `
678
678
methods of the handler classes.
679
679
680
680
Return values and exceptions raised are the same as those of :func: `urlopen `.
@@ -684,25 +684,25 @@ OpenerDirector objects open URLs in three stages:
684
684
The order in which these methods are called within each stage is determined by
685
685
sorting the handler instances.
686
686
687
- #. Every handler with a method named like :meth: `<protocol>_request ` has that
687
+ #. Every handler with a method named like :meth: `! <protocol>_request ` has that
688
688
method called to pre-process the request.
689
689
690
- #. Handlers with a method named like :meth: `<protocol>_open ` are called to handle
690
+ #. Handlers with a method named like :meth: `! <protocol>_open ` are called to handle
691
691
the request. This stage ends when a handler either returns a non-\ :const: `None `
692
692
value (ie. a response), or raises an exception (usually
693
693
:exc: `~urllib.error.URLError `). Exceptions are allowed to propagate.
694
694
695
695
In fact, the above algorithm is first tried for methods named
696
- :meth: `default_open `. If all such methods return :const: `None `, the algorithm
697
- is repeated for methods named like :meth: `<protocol>_open `. If all such methods
696
+ :meth: `~BaseHandler. default_open `. If all such methods return :const: `None `, the algorithm
697
+ is repeated for methods named like :meth: `! <protocol>_open `. If all such methods
698
698
return :const: `None `, the algorithm is repeated for methods named
699
- :meth: `unknown_open `.
699
+ :meth: `~BaseHandler. unknown_open `.
700
700
701
701
Note that the implementation of these methods may involve calls of the parent
702
702
:class: `OpenerDirector ` instance's :meth: `~OpenerDirector.open ` and
703
703
:meth: `~OpenerDirector.error ` methods.
704
704
705
- #. Every handler with a method named like :meth: `<protocol>_response ` has that
705
+ #. Every handler with a method named like :meth: `! <protocol>_response ` has that
706
706
method called to post-process the response.
707
707
708
708
@@ -751,7 +751,7 @@ The following attribute and methods should only be used by classes derived from
751
751
the return value of the :meth: `~OpenerDirector.open ` method of :class: `OpenerDirector `, or ``None ``.
752
752
It should raise :exc: `~urllib.error.URLError `, unless a truly exceptional
753
753
thing happens (for example, :exc: `MemoryError ` should not be mapped to
754
- :exc: `URLError `).
754
+ :exc: `~urllib.error. URLError `).
755
755
756
756
This method will be called before any protocol-specific open method.
757
757
@@ -764,7 +764,7 @@ The following attribute and methods should only be used by classes derived from
764
764
define it if they want to handle URLs with the given protocol.
765
765
766
766
This method, if defined, will be called by the parent :class: `OpenerDirector `.
767
- Return values should be the same as for :meth: `default_open `.
767
+ Return values should be the same as for :meth: `~BaseHandler. default_open `.
768
768
769
769
770
770
.. method :: BaseHandler.unknown_open(req)
@@ -804,7 +804,7 @@ The following attribute and methods should only be used by classes derived from
804
804
Subclasses should override this method to handle specific HTTP errors.
805
805
806
806
Arguments, return values and exceptions raised should be the same as for
807
- :meth: `http_error_default `.
807
+ :meth: `~BaseHandler. http_error_default `.
808
808
809
809
810
810
.. _protocol_request :
@@ -844,7 +844,7 @@ HTTPRedirectHandler Objects
844
844
is the case, :exc: `~urllib.error.HTTPError ` is raised. See :rfc: `2616 ` for
845
845
details of the precise meanings of the various redirection codes.
846
846
847
- An :class: ` HTTPError ` exception raised as a security consideration if the
847
+ An :exc: ` ~urllib.error. HTTPError ` exception raised as a security consideration if the
848
848
HTTPRedirectHandler is presented with a redirected URL which is not an HTTP,
849
849
HTTPS or FTP URL.
850
850
@@ -921,7 +921,7 @@ ProxyHandler Objects
921
921
.. method :: ProxyHandler.<protocol>_open(request)
922
922
:noindex:
923
923
924
- The :class: `ProxyHandler ` will have a method :meth: `<protocol>_open ` for every
924
+ The :class: `ProxyHandler ` will have a method :meth: `! <protocol>_open ` for every
925
925
*protocol * which has a proxy in the *proxies * dictionary given in the
926
926
constructor. The method will modify requests to go through the proxy, by
927
927
calling ``request.set_proxy() ``, and call the next handler in the chain to
@@ -1177,7 +1177,7 @@ HTTPErrorProcessor Objects
1177
1177
For 200 error codes, the response object is returned immediately.
1178
1178
1179
1179
For non-200 error codes, this simply passes the job on to the
1180
- :meth: `http_error_\< type\> ` handler methods, via :meth: `OpenerDirector.error `.
1180
+ :meth: `! http_error_\< type\> ` handler methods, via :meth: `OpenerDirector.error `.
1181
1181
Eventually, :class: `HTTPDefaultErrorHandler ` will raise an
1182
1182
:exc: `~urllib.error.HTTPError ` if no other handler handles the error.
1183
1183
@@ -1284,7 +1284,7 @@ Use of Basic HTTP Authentication::
1284
1284
:func: `build_opener ` provides many handlers by default, including a
1285
1285
:class: `ProxyHandler `. By default, :class: `ProxyHandler ` uses the environment
1286
1286
variables named ``<scheme>_proxy ``, where ``<scheme> `` is the URL scheme
1287
- involved. For example, the :envvar: `http_proxy ` environment variable is read to
1287
+ involved. For example, the :envvar: `! http_proxy ` environment variable is read to
1288
1288
obtain the HTTP proxy's URL.
1289
1289
1290
1290
This example replaces the default :class: `ProxyHandler ` with one that uses
@@ -1379,7 +1379,7 @@ some point in the future.
1379
1379
points to a local file, the object will not be copied unless filename is supplied.
1380
1380
Return a tuple ``(filename, headers) `` where *filename * is the
1381
1381
local file name under which the object can be found, and *headers * is whatever
1382
- the :meth: `info ` method of the object returned by :func: `urlopen ` returned (for
1382
+ the :meth: `! info ` method of the object returned by :func: `urlopen ` returned (for
1383
1383
a remote object). Exceptions are the same as for :func: `urlopen `.
1384
1384
1385
1385
The second argument, if present, specifies the file location to copy to (if
@@ -1404,7 +1404,7 @@ some point in the future.
1404
1404
:mimetype: `application/x-www-form-urlencoded ` format; see the
1405
1405
:func: `urllib.parse.urlencode ` function.
1406
1406
1407
- :func: `urlretrieve ` will raise :exc: `ContentTooShortError ` when it detects that
1407
+ :func: `urlretrieve ` will raise :exc: `~urllib.error. ContentTooShortError ` when it detects that
1408
1408
the amount of data available was less than the expected amount (which is the
1409
1409
size reported by a *Content-Length * header). This can occur, for example, when
1410
1410
the download is interrupted.
@@ -1413,8 +1413,8 @@ some point in the future.
1413
1413
urlretrieve reads more data, but if less data is available, it raises the
1414
1414
exception.
1415
1415
1416
- You can still retrieve the downloaded data in this case, it is stored in the
1417
- :attr: `content ` attribute of the exception instance.
1416
+ You can still retrieve the downloaded data in this case, it is stored in the
1417
+ :attr: `! content ` attribute of the exception instance.
1418
1418
1419
1419
If no *Content-Length * header was supplied, urlretrieve can not check the size
1420
1420
of the data it has downloaded, and just returns it. In this case you just have
@@ -1508,7 +1508,7 @@ some point in the future.
1508
1508
authentication is performed. For the 30x response codes, recursion is bounded
1509
1509
by the value of the *maxtries * attribute, which defaults to 10.
1510
1510
1511
- For all other response codes, the method :meth: `http_error_default ` is called
1511
+ For all other response codes, the method :meth: `~BaseHandler. http_error_default ` is called
1512
1512
which you can override in subclasses to handle the error appropriately.
1513
1513
1514
1514
.. note ::
0 commit comments