ssl.py 847 B

1234567891011121314151617181920212223242526
  1. """
  2. Secure Sockets Layer (SSL/TLS) module.
  3. """
  4. from gevent._compat import PY2
  5. from gevent._util import copy_globals
  6. # things we expect to override, here for static analysis
  7. def wrap_socket(_sock, **_kwargs):
  8. # pylint:disable=unused-argument
  9. raise NotImplementedError()
  10. if PY2:
  11. if hasattr(__import__('ssl'), 'SSLContext'):
  12. # It's not sufficient to check for >= 2.7.9; some distributions
  13. # have backported most of PEP 466. Try to accommodate them. See Issue #702.
  14. # We're just about to import ssl anyway so it's fine to import it here, just
  15. # don't pollute the namespace
  16. from gevent import _sslgte279 as _source
  17. else:
  18. from gevent import _ssl2 as _source # pragma: no cover
  19. else:
  20. # Py3
  21. from gevent import _ssl3 as _source # pragma: no cover
  22. copy_globals(_source, globals())