Title: Documentation confusion in CookieJar functions
Type: enhancement Stage:
Components: Documentation Versions: Python 3.8
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, eric.araujo, markus
Priority: normal Keywords:

Created on 2020-10-14 15:23 by markus, last changed 2020-10-21 08:30 by markus.

Messages (7)
msg378624 - (view) Author: Markus Israelsson (markus) Date: 2020-10-14 15:23
The documentation in
claims the following for functions add_cookie_header and extract_cookies.

The request object (usually a urllib.request.Request instance) must support the methods get_full_url(), get_host(), get_type(), unverifiable(), has_header(), get_header(), header_items(), add_unredirected_header() and origin_req_host attribute as documented by urllib.request.

When reading the documentation for Request Objects
there is this:
Changed in version 3.4: The request methods add_data, has_data, get_data, get_type, get_host, get_selector, get_origin_req_host and is_unverifiable that were deprecated since 3.3 have been removed.

So basically the documentation claims that if the request object does not support functions that are removed then the headers will not be added. The code itself seem to do the correct thing however and add the header.
msg379013 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2020-10-19 20:41
Hello!  I don’t see the problem that you are mentioning: the request methods removed from Request objects are not in the list of methods required by the CookieJar methods.
msg379088 - (view) Author: Markus Israelsson (markus) Date: 2020-10-20 05:45
The way I read the documentation for add_cookie_header is:

These methods must exist in the Request object:
- get_full_url()
- get_host()
- get_type()
- unverifiable... and so on.

The documentation for the request objects claims however that:
These methods are removed since version 3.4:
- add_data
- has_data
- get_data
- get_type
- get_host - This method , and some others, are listed as requirements for the add_cookie_header and extract_cookies functions. See list above or link I posted above to the correct places in the docs.

So it is only the documentation that is inconsistent. Not the code.
Unless, like I said, I misunderstand something in the documentation.
msg379138 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2020-10-20 14:54
Ah, I see it now: get_host and get_type are in both lists!

Would you like to contribute a fix for the docs?
If yes, help is here:
msg379198 - (view) Author: Markus Israelsson (markus) Date: 2020-10-21 07:12

But I will need to get an ok from my company to spend some time on this because I really am not very used to git yet (recently switched).

Also, is it possible to make the request/changes through the company github account or must that in that case be tied directly to this bug report account?
msg379199 - (view) Author: Markus Israelsson (markus) Date: 2020-10-21 07:13
I guess due to something having to be signed I would have to create a personal github account :/
msg379200 - (view) Author: Markus Israelsson (markus) Date: 2020-10-21 08:30
I got ok from the higherups.
Will plan this into next sprint so it will take a week or 2 before I get to it.
Date User Action Args
2020-10-21 08:30:54markussetmessages: + msg379200
2020-10-21 07:13:55markussetmessages: + msg379199
2020-10-21 07:12:45markussetmessages: + msg379198
2020-10-20 14:54:55eric.araujosetmessages: + msg379138
2020-10-20 05:45:04markussetmessages: + msg379088
2020-10-19 20:41:41eric.araujosetnosy: + eric.araujo
messages: + msg379013
2020-10-14 15:23:42markuscreate