@@ -422,7 +422,7 @@ The following classes are provided:
422422 received the request is re-sent with the authentication credentials. If
423423 authentication succeeds, ``update_authenticated `` is called to set
424424 ``is_authenticated `` ``True `` for the URI, so that subsequent requests to
425- the URI or any of its super-URIs will automatically include the
425+ the URI itself or any path below it will automatically include the
426426 authentication credentials.
427427
428428 .. versionadded :: 3.5
@@ -855,7 +855,7 @@ The following attribute and methods should only be used by classes derived from
855855
856856 1. a :class: `Request ` object,
857857 #. a file-like object with the HTTP error body,
858- #. the three-digit code of the error, as a string ,
858+ #. the three-digit code of the error, as an integer ,
859859 #. the user-visible explanation of the code, as a string, and
860860 #. the headers of the error, as a mapping object.
861861
@@ -1009,11 +1009,10 @@ These methods are available on :class:`HTTPPasswordMgr` and
10091009.. method :: HTTPPasswordMgr.add_password(realm, uri, user, passwd)
10101010
10111011 *uri * can be either a single URI, or a sequence of URIs. *realm *, *user * and
1012- *passwd * must be strings. This causes ``(user, passwd) `` to be used as
1013- authentication tokens when authentication for *realm * and a super-URI of any
1014- of the given URIs is given. If a URI includes a scheme, its credentials only
1015- match authentication URIs with the same scheme or no scheme. A URI without a
1016- scheme matches authentication URIs with any scheme.
1012+ *passwd * must be strings. The credentials for *realm * apply to any registered
1013+ URI and to paths below it. If a URI includes a scheme,
1014+ its credentials only match authentication URIs with the same scheme or no
1015+ scheme. A URI without a scheme matches authentication URIs with any scheme.
10171016
10181017 .. versionchanged :: 3.16
10191018 Authentication credentials for URIs with a scheme are now scoped by
@@ -1229,8 +1228,9 @@ FTPHandler Objects
12291228
12301229.. method :: FTPHandler.ftp_open(req)
12311230
1232- Open the FTP file indicated by *req *. The login is always done with empty
1233- username and password.
1231+ Open the FTP file indicated by *req *. The username and password are taken
1232+ from the URL, with missing values defaulting to empty strings. See
1233+ :meth: `ftplib.FTP.login ` for the login defaults.
12341234
12351235
12361236.. _cacheftp-handler-objects :
@@ -1272,9 +1272,9 @@ HTTPErrorProcessor Objects
12721272
12731273 Process HTTP error responses.
12741274
1275- For 200 error codes, the response object is returned immediately.
1275+ For 2xx status codes, the response object is returned immediately.
12761276
1277- For non-200 error codes, this simply passes the job on to the
1277+ For other status codes, this simply passes the job on to the
12781278 :meth: `!http_error_\< type\> ` handler methods, via :meth: `OpenerDirector.error `.
12791279 Eventually, :class: `HTTPDefaultErrorHandler ` will raise an
12801280 :exc: `~urllib.error.HTTPError ` if no other handler handles the error.
@@ -1308,11 +1308,11 @@ it::
13081308 ... data = gzip.decompress(data)
13091309 ... print(data[:300].decode('utf-8', errors='replace'))
13101310
1311- Note that urlopen returns a bytes object. This is because there is no way
1312- for urlopen to automatically determine the encoding of the byte stream
1313- it receives from the HTTP server. In general, a program will decode
1314- the returned bytes object to string once it determines or guesses
1315- the appropriate encoding.
1311+ Note that calling `` read() `` on the response returned by :func: ` urlopen ` returns
1312+ a :class: ` bytes ` object. This is because there is no way for :func: ` urlopen ` to
1313+ automatically determine the encoding of the byte stream it receives from the
1314+ HTTP server. In general, a program will decode the returned bytes object to a
1315+ string once it determines or guesses the appropriate encoding.
13161316
13171317The following HTML spec document, https://html.spec.whatwg.org/#charset, lists
13181318the various ways in which an HTML or an XML document could have specified its
@@ -1511,7 +1511,7 @@ The following example uses an explicitly specified HTTP proxy, overriding
15111511environment settings::
15121512
15131513 >>> import urllib.request
1514- >>> proxies = {'http ': 'http://proxy.example.com:8080/'}
1514+ >>> proxies = {'https ': 'http://proxy.example.com:8080/'}
15151515 >>> opener = urllib.request.build_opener(urllib.request.ProxyHandler(proxies))
15161516 >>> with opener.open("https://www.python.org") as f:
15171517 ... f.read().decode('utf-8')
@@ -1660,7 +1660,8 @@ The typical response object is a :class:`urllib.response.addinfourl` instance:
16601660
16611661 .. attribute :: headers
16621662
1663- Returns the headers of the response in the form of an :class: `~email.message.EmailMessage ` instance.
1663+ Returns the headers of the response in the form of an
1664+ :class: `~email.message.Message ` instance.
16641665
16651666 .. attribute :: status
16661667
0 commit comments