Skip to main content

The Python 3.4 standard `ssl` module API implemented on top of pyOpenSSL

Project description

-------------
backports.ssl
-------------

What is it?
-----------

It's the Python 3.4 standard ``ssl`` module API implemented on top of
pyOpenSSL::

import backports.ssl as ssl
import socket

context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
context.verify_mode = ssl.CERT_REQUIRED

conn = context.wrap_socket(socket.socket(socket.AF_INET))
conn.connect(('google.com', 443))
print conn.getpeercert()
conn.close()

Why?
----

Because the latest web technologies should be available to those running older
versions of Python.

Isn't this obsoleted by `PEP 466`_?
-----------------------------------

If you're on Python 2.7, then probably. But PEP 466 doesn't cover Python 2.6,
3.2, or 3.3, and the ``ssl.RAND_*()`` functions are explicitly out of scope.
This package supports it all.

How do I use it with third-party libraries?
-------------------------------------------

Monkey-patching support is included a la `gevent`_::

import backports.ssl.monkey as monkey
import requests

monkey.patch()
requests.get('https://google.com')


Why am I getting ``AttributeError``\ s for newer features?
------------------------------------------------------

Like the standard ``ssl`` module, certain attributes will not be available if
your OpenSSL does not support them. See `Installing OpenSSL`_ for instructions.

Installing OpenSSL
------------------

TODO
----

- Verify that we play nicely with gevent's monkey-patching.
- Backport and pass the standard Python ``ssl`` test suite.
- If not that, automate testing against hyper, urllib3, requests, and Tornado
test suites.
- Use the bundled 3.x OpenSSL, if available and newer than the default.

.. _`PEP 466`: http://legacy.python.org/dev/peps/pep-0466
.. _`gevent`: http://gevent.org

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

backports.ssl-0.0.7.tar.gz (11.4 kB view details)

Uploaded Source

File details

Details for the file backports.ssl-0.0.7.tar.gz.

File metadata

  • Download URL: backports.ssl-0.0.7.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for backports.ssl-0.0.7.tar.gz
Algorithm Hash digest
SHA256 a0eb2edd8f5925b76781e5f56a0e17542b25da0ffcf1cdb126fc8d524df9fbc4
MD5 c58f1a6a6facc8fe123ddf0522c674b5
BLAKE2b-256 f9d0cb560d29b6db6cd15a01c84bdb359ad49ed733ff2ce2f3b924f5096405ac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page