New submission from Markus Israelsson markus.israelsson@surgicalscience.com:
The documentation in https://docs.python.org/3.8/library/http.cookiejar.html#http.cookiejar.Cooki... 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 https://docs.python.org/3.8/library/urllib.request.html?highlight=requests#r... 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.
---------- assignee: docs@python components: Documentation messages: 378624 nosy: docs@python, markus priority: normal severity: normal status: open title: Documentation confusion in CookieJar functions type: enhancement versions: Python 3.8
_______________________________________ Python tracker report@bugs.python.org https://bugs.python.org/issue42037 _______________________________________
Éric Araujo merwok@netwok.org added the comment:
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.
---------- nosy: +eric.araujo
_______________________________________ Python tracker report@bugs.python.org https://bugs.python.org/issue42037 _______________________________________
Markus Israelsson markus.israelsson@surgicalscience.com added the comment:
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.
----------
_______________________________________ Python tracker report@bugs.python.org https://bugs.python.org/issue42037 _______________________________________
Éric Araujo merwok@netwok.org added the comment:
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: https://devguide.python.org/docquality/
----------
_______________________________________ Python tracker report@bugs.python.org https://bugs.python.org/issue42037 _______________________________________
Markus Israelsson markus.israelsson@surgicalscience.com added the comment:
Sure.
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?
----------
_______________________________________ Python tracker report@bugs.python.org https://bugs.python.org/issue42037 _______________________________________
Markus Israelsson markus.israelsson@surgicalscience.com added the comment:
I guess due to something having to be signed I would have to create a personal github account :/
----------
_______________________________________ Python tracker report@bugs.python.org https://bugs.python.org/issue42037 _______________________________________
Markus Israelsson markus.israelsson@surgicalscience.com added the comment:
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.
----------
_______________________________________ Python tracker report@bugs.python.org https://bugs.python.org/issue42037 _______________________________________
Éric Araujo merwok@netwok.org added the comment:
Yes, you will need a github account linked to a bpo (this site) account so that the contributor agreement bot can do its job.
----------
_______________________________________ Python tracker report@bugs.python.org https://bugs.python.org/issue42037 _______________________________________
Markus Israelsson markus.israelsson@surgicalscience.com added the comment:
I am currently updating the documentation source code. On the cookiejar page it describes 'unverifiable' as a method. I can however not find that method on the request page because it seems to be just a normal attribute.
I will make updates for that as well if that is ok with you?
----------
_______________________________________ Python tracker report@bugs.python.org https://bugs.python.org/issue42037 _______________________________________
Change by Roundup Robot devnull@psf.upfronthosting.co.za:
---------- keywords: +patch nosy: +python-dev nosy_count: 3.0 -> 4.0 pull_requests: +22029 stage: -> patch review pull_request: https://github.com/python/cpython/pull/23112
_______________________________________ Python tracker report@bugs.python.org https://bugs.python.org/issue42037 _______________________________________
Andrei Kulakov andrei.avk@gmail.com added the comment:
I can confirm `unverifiable` is an attr: https://github.com/python/cpython/blob/master/Lib/urllib/request.py#L333
and so is incorrectly listed as a method in cookie jar docs.
---------- nosy: +andrei.avk
_______________________________________ Python tracker report@bugs.python.org https://bugs.python.org/issue42037 _______________________________________