@@ -98,7 +98,7 @@ The following classes are provided:
9898 1) are treated according to the RFC 2965 rules. However, if RFC 2965 handling
9999 is turned off or :attr: `rfc2109_as_netscape ` is ``True ``, RFC 2109 cookies are
100100 'downgraded' by the :class: `CookieJar ` instance to Netscape cookies, by
101- setting the :attr: `version ` attribute of the :class: `Cookie ` instance to 0.
101+ setting the :attr: `~Cookie. version ` attribute of the :class: `Cookie ` instance to 0.
102102 :class: `DefaultCookiePolicy ` also provides some parameters to allow some
103103 fine-tuning of policy.
104104
@@ -107,7 +107,7 @@ The following classes are provided:
107107
108108 This class represents Netscape, :rfc: `2109 ` and :rfc: `2965 ` cookies. It is not
109109 expected that users of :mod: `!http.cookiejar ` construct their own :class: `Cookie `
110- instances. Instead, if necessary, call :meth: `make_cookies ` on a
110+ instances. Instead, if necessary, call :meth: `~CookieJar. make_cookies ` on a
111111 :class: `CookieJar ` instance.
112112
113113
@@ -154,20 +154,27 @@ contained :class:`Cookie` objects.
154154
155155 Add correct :mailheader: `Cookie ` header to *request *.
156156
157- If policy allows (ie. the :attr: `rfc2965 ` and :attr: `hide_cookie2 ` attributes of
157+ If policy allows (ie. the :attr: `~CookiePolicy.rfc2965 ` and
158+ :attr: `~CookiePolicy.hide_cookie2 ` attributes of
158159 the :class: `CookieJar `'s :class: `CookiePolicy ` instance are true and false
159160 respectively), the :mailheader: `Cookie2 ` header is also added when appropriate.
160161
161162 The *request * object (usually a :class: `urllib.request.Request ` instance)
162- must support the methods :meth: `get_full_url `, :meth: `has_header `,
163- :meth: `get_header `, :meth: `header_items `, :meth: `add_unredirected_header `
164- and the attributes :attr: `host `, :attr: `!type `, :attr: `unverifiable `
165- and :attr: `origin_req_host ` as documented by :mod: `urllib.request `.
163+ must support the methods :meth: `~urllib.request.Request.get_full_url `,
164+ :meth: `~urllib.request.Request.has_header `,
165+ :meth: `~urllib.request.Request.get_header `,
166+ :meth: `~urllib.request.Request.header_items `,
167+ :meth: `~urllib.request.Request.add_unredirected_header `
168+ and the attributes :attr: `~urllib.request.Request.host `, :attr: `!type `,
169+ :attr: `~urllib.request.Request.unverifiable `
170+ and :attr: `~urllib.request.Request.origin_req_host ` as documented by
171+ :mod: `urllib.request `.
166172
167173 .. versionchanged :: 3.3
168174
169- *request * object needs :attr: `origin_req_host ` attribute. Dependency on a
170- deprecated method :meth: `get_origin_req_host ` has been removed.
175+ *request * object needs :attr: `~urllib.request.Request.origin_req_host `
176+ attribute. Dependency on a deprecated method ``get_origin_req_host `` has
177+ been removed.
171178
172179
173180.. method :: CookieJar.extract_cookies(response, request)
@@ -180,20 +187,24 @@ contained :class:`Cookie` objects.
180187 as appropriate (subject to the :meth: `CookiePolicy.set_ok ` method's approval).
181188
182189 The *response * object (usually the result of a call to
183- :meth: `urllib.request.urlopen `, or similar) should support an :meth: `info `
184- method, which returns an :class: `email.message.Message ` instance.
190+ :meth: `urllib.request.urlopen `, or similar) should support an
191+ :meth: `~urllib.response.addinfourl.info ` method, which returns an
192+ :class: `email.message.Message ` instance.
185193
186194 The *request * object (usually a :class: `urllib.request.Request ` instance)
187- must support the method :meth: `get_full_url ` and the attributes
188- :attr: `host `, :attr: `unverifiable ` and :attr: `origin_req_host `,
195+ must support the method :meth: `~urllib.request.Request.get_full_url ` and
196+ the attributes :attr: `~urllib.request.Request.host `,
197+ :attr: `~urllib.request.Request.unverifiable `
198+ and :attr: `~urllib.request.Request.origin_req_host `,
189199 as documented by :mod: `urllib.request `. The request is used to set
190200 default values for cookie-attributes as well as for checking that the
191201 cookie is allowed to be set.
192202
193203 .. versionchanged :: 3.3
194204
195- *request * object needs :attr: `origin_req_host ` attribute. Dependency on a
196- deprecated method :meth: `get_origin_req_host ` has been removed.
205+ *request * object needs :attr: `~urllib.request.Request.origin_req_host `
206+ attribute. Dependency on a deprecated method ``get_origin_req_host `` has
207+ been removed.
197208
198209.. method :: CookieJar.set_policy(policy)
199210
@@ -236,13 +247,13 @@ contained :class:`Cookie` objects.
236247
237248 Discard all session cookies.
238249
239- Discards all contained cookies that have a true :attr: `discard ` attribute
250+ Discards all contained cookies that have a true :attr: `~Cookie. discard ` attribute
240251 (usually because they had either no ``max-age `` or ``expires `` cookie-attribute,
241252 or an explicit ``discard `` cookie-attribute). For interactive browsers, the end
242253 of a session usually corresponds to closing the browser window.
243254
244- Note that the :meth: `save ` method won't save session cookies anyway, unless you
245- ask otherwise by passing a true *ignore_discard * argument.
255+ Note that the :meth: `~FileCookieJar. save ` method won't save session cookies
256+ anyway, unless you ask otherwise by passing a true *ignore_discard * argument.
246257
247258:class: `FileCookieJar ` implements the following additional methods:
248259
@@ -255,8 +266,9 @@ contained :class:`Cookie` objects.
255266 method unimplemented.
256267
257268 *filename * is the name of file in which to save cookies. If *filename * is not
258- specified, :attr: `self.filename ` is used (whose default is the value passed to
259- the constructor, if any); if :attr: `self.filename ` is :const: `None `,
269+ specified, :attr: `~FileCookieJar.filename ` is used (whose default is the
270+ value passed to the constructor, if any); if
271+ :attr: `~FileCookieJar.filename ` is :const: `None `,
260272 :exc: `ValueError ` is raised.
261273
262274 *ignore_discard *: save even cookies set to be discarded. *ignore_expires *: save
@@ -463,9 +475,10 @@ blocking some benign cookies).
463475A domain blocklist and allowlist is provided (both off by default). Only domains
464476not in the blocklist and present in the allowlist (if the allowlist is active)
465477participate in cookie setting and returning. Use the *blocked_domains *
466- constructor argument, and :meth: `blocked_domains ` and
467- :meth: `set_blocked_domains ` methods (and the corresponding argument and methods
468- for *allowed_domains *). If you set an allowlist, you can turn it off again by
478+ constructor argument, and :meth: `~DefaultCookiePolicy.blocked_domains ` and
479+ :meth: `~DefaultCookiePolicy.set_blocked_domains ` methods (and the corresponding
480+ argument and methods for *allowed_domains *). If you set an allowlist, you can
481+ turn it off again by
469482setting it to :const: `None `.
470483
471484Domains in block or allow lists that do not start with a dot must equal the
0 commit comments