Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

urllib.request.urlopen should take a "context" (SSLContext) argument #66562

Closed
alex opened this issue Sep 8, 2014 · 16 comments
Closed

urllib.request.urlopen should take a "context" (SSLContext) argument #66562

alex opened this issue Sep 8, 2014 · 16 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@alex
Copy link
Member

alex commented Sep 8, 2014

BPO 22366
Nosy @ncoghlan, @orsenthil, @pitrou, @larryhastings, @giampaolo, @tiran, @alex, @dstufft
Files
  • urlopen-context.diff
  • urlopen-context.diff
  • urlopen-context.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/orsenthil'
    closed_at = <Date 2014-09-19.07:26:02.958>
    created_at = <Date 2014-09-08.17:45:52.591>
    labels = ['library']
    title = 'urllib.request.urlopen should take a "context" (SSLContext) argument'
    updated_at = <Date 2014-11-24.04:58:39.680>
    user = 'https://github.com/alex'

    bugs.python.org fields:

    activity = <Date 2014-11-24.04:58:39.680>
    actor = 'benjamin.peterson'
    assignee = 'orsenthil'
    closed = True
    closed_date = <Date 2014-09-19.07:26:02.958>
    closer = 'orsenthil'
    components = ['Library (Lib)']
    creation = <Date 2014-09-08.17:45:52.591>
    creator = 'alex'
    dependencies = []
    files = ['36573', '36576', '36580']
    hgrepos = []
    issue_num = 22366
    keywords = ['patch', 'needs review']
    message_count = 16.0
    messages = ['226594', '226595', '226609', '226619', '226672', '226676', '227077', '227080', '227081', '227091', '227092', '227101', '227106', '230514', '230562', '231574']
    nosy_count = 11.0
    nosy_names = ['ncoghlan', 'janssen', 'orsenthil', 'pitrou', 'larry', 'giampaolo.rodola', 'christian.heimes', 'Arfrever', 'alex', 'python-dev', 'dstufft']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue22366'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

    @alex
    Copy link
    Member Author

    alex commented Sep 8, 2014

    Instead of the ca* arguments it currently takes, these can all be encapsulated into an SSLContext argument, which the underlying http.client already supports.

    @alex alex added the stdlib Python modules in the Lib dir label Sep 8, 2014
    @alex
    Copy link
    Member Author

    alex commented Sep 8, 2014

    Attached patch against the default branch adds support for this.

    @alex
    Copy link
    Member Author

    alex commented Sep 8, 2014

    Added a versionchanged directive to the docs.

    @alex
    Copy link
    Member Author

    alex commented Sep 9, 2014

    New patch switches to a ValueError and includes a test case that it's raised.

    @orsenthil
    Copy link
    Member

    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)

    @alex
    Copy link
    Member Author

    alex commented Sep 10, 2014

    Replied to the review; let me know if you agree with my comment.

    @alex alex assigned orsenthil and unassigned alex Sep 10, 2014
    @alex
    Copy link
    Member Author

    alex commented Sep 19, 2014

    Just wanted to ping you on this Senthil about committing this.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 19, 2014

    New changeset c0b0dda16009 by Senthil Kumaran in branch 'default':
    Issue bpo-22366: urllib.request.urlopen will accept a context object (SSLContext)
    https://hg.python.org/cpython/rev/c0b0dda16009

    @orsenthil
    Copy link
    Member

    Committed this in 3.5. (Since this is adding an new argument, it should not be backported to 3.4).

    Thank you!

    @larryhastings
    Copy link
    Contributor

    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).

    @ncoghlan
    Copy link
    Contributor

    Larry, it's probably easiest to cover the backport under bpo-22417 with the rest of the proposed PEP-476 changes.

    @orsenthil
    Copy link
    Member

    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 ?

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 19, 2014

    New changeset 9c3249b358d0 by Alex Gaynor in branch 'default':
    PEP-476: Updated based on proposed API from Nick. Also note that bpo-22366 has been landed.
    https://hg.python.org/peps/rev/9c3249b358d0

    @Arfrever Arfrever mannequin changed the title urllib.request.urlopen shoudl take a "context" (SSLContext) argument urllib.request.urlopen should take a "context" (SSLContext) argument Sep 21, 2014
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 2, 2014

    New changeset 13f46fc1a002 by Senthil Kumaran in branch '3.4':
    backport context argument of urlopen (bpo-22366) for PEP-476
    https://hg.python.org/cpython/rev/13f46fc1a002

    @Arfrever
    Copy link
    Mannequin

    Arfrever mannequin commented Nov 3, 2014

    Please update versionchanged to 3.4.3 on default branch.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 23, 2014

    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

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants