This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: urllib.request.urlopen should take a "context" (SSLContext) argument
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: orsenthil Nosy List: Arfrever, alex, christian.heimes, dstufft, giampaolo.rodola, janssen, larry, ncoghlan, orsenthil, pitrou, python-dev
Priority: normal Keywords: needs review, patch

Created on 2014-09-08 17:45 by alex, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
urlopen-context.diff alex, 2014-09-08 18:21 review
urlopen-context.diff alex, 2014-09-08 20:12 review
urlopen-context.diff alex, 2014-09-09 03:48 review
Messages (16)
msg226594 - (view) Author: Alex Gaynor (alex) * (Python committer) Date: 2014-09-08 17:45
Instead of the ca* arguments it currently takes, these can all be encapsulated into an SSLContext argument, which the underlying http.client already supports.
msg226595 - (view) Author: Alex Gaynor (alex) * (Python committer) Date: 2014-09-08 18:21
Attached patch against the default branch adds support for this.
msg226609 - (view) Author: Alex Gaynor (alex) * (Python committer) Date: 2014-09-08 20:12
Added a versionchanged directive to the docs.
msg226619 - (view) Author: Alex Gaynor (alex) * (Python committer) Date: 2014-09-09 03:48
New patch switches to a ValueError and includes a test case that it's raised.
msg226672 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2014-09-10 01:42
With the final review comment addressed, this could go in. Since you have commit rights, please feel free to commit it. (else, please assign this to me and I will commit and follow up with the buildbots)
msg226676 - (view) Author: Alex Gaynor (alex) * (Python committer) Date: 2014-09-10 02:57
Replied to the review; let me know if you agree with my comment.
msg227077 - (view) Author: Alex Gaynor (alex) * (Python committer) Date: 2014-09-19 01:02
Just wanted to ping you on this Senthil about committing this.
msg227080 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-09-19 07:23
New changeset c0b0dda16009 by Senthil Kumaran in branch 'default':
Issue #22366: urllib.request.urlopen will accept a context object (SSLContext)
https://hg.python.org/cpython/rev/c0b0dda16009
msg227081 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2014-09-19 07:26
Committed this in 3.5. (Since this is adding an new argument, it should not be backported to 3.4).

Thank you!
msg227091 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-09-19 12:40
Alex said he needed this in order to implement PEP 476, and I thought PEP 476 was going in to 3.4 (hopefully for 3.4.2, which I'm tagging in like 24 hours).
msg227092 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2014-09-19 13:30
Larry, it's probably easiest to cover the backport under issue 22417 with the rest of the proposed PEP 476 changes.
msg227101 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2014-09-19 14:20
My worry is not about the timing. I can add it immediately, but are we convinced on having a new argument (API Change) for 3.4.2 ?
msg227106 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-09-19 16:51
New changeset 9c3249b358d0 by Alex Gaynor in branch 'default':
PEP476: Updated based on proposed API from Nick. Also note that #22366 has been landed.
https://hg.python.org/peps/rev/9c3249b358d0
msg230514 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-11-02 18:19
New changeset 13f46fc1a002 by Senthil Kumaran in branch '3.4':
backport context argument of urlopen (#22366) for pep 476
https://hg.python.org/cpython/rev/13f46fc1a002
msg230562 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2014-11-03 20:40
Please update versionchanged to 3.4.3 on default branch.
msg231574 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-11-23 17:46
New changeset 1882157b298a by Benjamin Peterson in branch '2.7':
allow passing cert/ssl information to urllib2.urlopen and httplib.HTTPSConnection
https://hg.python.org/cpython/rev/1882157b298a
History
Date User Action Args
2022-04-11 14:58:07adminsetgithub: 66562
2014-11-24 04:58:39benjamin.petersonsetversions: + Python 2.7
2014-11-23 17:46:30python-devsetmessages: + msg231574
2014-11-03 20:40:56Arfreversetmessages: + msg230562
2014-11-02 22:12:44Arfreversetversions: + Python 3.4
2014-11-02 18:19:24python-devsetmessages: + msg230514
2014-09-21 09:57:07Arfreversetnosy: + Arfrever

title: urllib.request.urlopen shoudl take a "context" (SSLContext) argument -> urllib.request.urlopen should take a "context" (SSLContext) argument
2014-09-19 16:51:38python-devsetmessages: + msg227106
2014-09-19 14:20:29orsenthilsetmessages: + msg227101
2014-09-19 13:38:56ncoghlanlinkissue22417 dependencies
2014-09-19 13:30:05ncoghlansetnosy: + ncoghlan
messages: + msg227092
2014-09-19 12:40:38larrysetnosy: + larry
messages: + msg227091
2014-09-19 07:26:02orsenthilsetstatus: open -> closed
versions: - Python 3.4
messages: + msg227081

resolution: fixed
stage: resolved
2014-09-19 07:23:42python-devsetnosy: + python-dev
messages: + msg227080
2014-09-19 01:02:06alexsetmessages: + msg227077
2014-09-10 02:57:40alexsetassignee: alex -> orsenthil
messages: + msg226676
2014-09-10 01:43:26orsenthilsetassignee: alex
2014-09-10 01:42:24orsenthilsetmessages: + msg226672
2014-09-09 03:48:36alexsetfiles: + urlopen-context.diff

messages: + msg226619
2014-09-08 20:12:22alexsetfiles: + urlopen-context.diff

messages: + msg226609
2014-09-08 18:21:44alexsetkeywords: + patch, needs review
files: + urlopen-context.diff
messages: + msg226595
2014-09-08 17:45:52alexcreate