Module Expr Str ImportFrom alias ImportFrom alias identifier Import alias ImportFrom alias identifier ImportFrom alias alias ImportFrom alias Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias Assign NameStore ListLoad Str Str Assign NameStore NameLoad Assign NameStore Dict AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Dict AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr BinOpAdd AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore BinOpAdd BinOpAdd Str Str Str Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr FunctionDef arguments args defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore BinOpAdd AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr Num Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore ListLoad If UnaryOpNot NameLoad body Return NameLoad Assign NameStore Call NameLoad For NameStore Call NameLoad Call AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr If CompareNotEq NameLoad Str body Continue Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad For NameStore NameLoad body If UnaryOpNot Call NameLoad NameLoad NameLoad body Continue For NameStore Call NameLoad Call NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareNotEq Call AttributeLoad NameLoad attr Str body Continue Expr Call AttributeLoad NameLoad attr Call NameLoad Call AttributeLoad NameLoad attr Return NameLoad decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults Num body Assign NameStore Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Num Num If CompareLt NameLoad Num body Assign AttributeStore NameLoad attr Call NameLoad While NameLoad body TryExcept body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad handlers ExceptHandler type AttributeLoad AttributeLoad NameLoad attr attr body Continue If UnaryOpNot NameLoad body Break Expr Call AttributeLoad NameLoad attr NameLoad Return Call AttributeLoad NameLoad attr orelse Assign NameStore Call AttributeLoad NameLoad attr If CompareGtE NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr Return NameLoad Assign AttributeStore NameLoad attr Call NameLoad While NameLoad body Assign NameStore BinOpSub NameLoad NameLoad TryExcept body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad handlers ExceptHandler type AttributeLoad AttributeLoad NameLoad attr attr body Continue If UnaryOpNot NameLoad body Break Assign NameStore Call NameLoad NameLoad If BoolOpAnd CompareEq NameLoad NameLoad UnaryOpNot NameLoad body Return NameLoad If CompareEq NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Delete NameDel Break Assert CompareLtE NameLoad NameLoad BinOpMod Str TupleLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad AugAssignAdd NameStore NameLoad Delete NameDel Return Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults Num body Assign NameStore AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Num Num If CompareGt Call AttributeLoad NameLoad attr Num body Expr Call AttributeLoad NameLoad attr Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad If BoolOpOr Call AttributeLoad NameLoad attr Str CompareEq Call NameLoad NameLoad NameLoad body Assign AttributeStore NameLoad attr Call NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr Return NameLoad Delete NameDel If CompareLt NameLoad Num body If CompareLtE AttributeLoad NameLoad attr Num body Expr Call AttributeLoad NameLoad attr Num Assign NameStore ListLoad Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call NameLoad Assign NameStore NameLoad Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr While NameLoad body TryExcept body While CompareNotEq NameLoad Str body Assign NameStore Call NameLoad Num If UnaryOpNot NameLoad body Break Expr Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type AttributeLoad AttributeLoad NameLoad attr attr body Continue Break Return Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad NameLoad attr Num Num Assign AttributeStore NameLoad attr Call NameLoad While NameLoad body TryExcept body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr handlers ExceptHandler type AttributeLoad AttributeLoad NameLoad attr attr body Continue If UnaryOpNot NameLoad body Break Assign NameStore Call AttributeLoad NameLoad attr Str If CompareGtE NameLoad Num body AugAssignAdd NameStore Num Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad NameLoad Slice NameLoad Delete NameDel Break Expr Call AttributeLoad NameLoad attr NameLoad Return Call AttributeLoad NameLoad attr orelse Expr Call AttributeLoad NameLoad attr Num Num Assign NameStore Call AttributeLoad NameLoad attr If CompareGtE NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr Return NameLoad Assign AttributeStore NameLoad attr Call NameLoad While NameLoad body TryExcept body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr handlers ExceptHandler type AttributeLoad AttributeLoad NameLoad attr attr body Continue If UnaryOpNot NameLoad body Break Assign NameStore BinOpSub NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Num NameLoad If CompareGtE NameLoad Num body AugAssignAdd NameStore Num Expr Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad NameLoad Slice NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice NameLoad Break orelse Return SubscriptLoad NameLoad Slice NameLoad Assign NameStore Call NameLoad NameLoad If BoolOpAnd CompareEq NameLoad NameLoad UnaryOpNot NameLoad body Return NameLoad If CompareGtE NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad NameLoad Slice NameLoad Break Expr Call AttributeLoad NameLoad attr NameLoad AugAssignAdd NameStore NameLoad Return Call AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Num body Return Call NameLoad AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If UnaryOpNot NameLoad body Return NameLoad If NameLoad body Return Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr NameLoad Return Dict Str Str TupleLoad TupleLoad TupleLoad Str AttributeLoad Call AttributeLoad NameLoad attr attr ListComp TupleLoad Str NameLoad comprehension NameStore Call NameLoad NameLoad decorator_list decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Return CompareEq NameLoad Num decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad NameLoad Index NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad If CompareNotEq NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad NameLoad If NameLoad body TryExcept body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad handlers ExceptHandler type AttributeLoad AttributeLoad NameLoad attr attr name NameStore body Raise Call AttributeLoad NameLoad attr BinOpMod Str NameLoad NameLoad Assign NameStore Num Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr While NameLoad body TryExcept body Expr Call AttributeLoad NameLoad attr handlers ExceptHandler type AttributeLoad AttributeLoad NameLoad attr attr body Expr Call AttributeLoad NameLoad attr ListLoad NameLoad ListLoad ListLoad Continue ExceptHandler type AttributeLoad AttributeLoad NameLoad attr attr name NameStore body Raise Call AttributeLoad NameLoad attr Str NameLoad Break Return Call NameLoad NameLoad NameLoad decorator_list
N/A N/A SSL with SNI_-support for Python 2.

This needs the following packages installed:

* pyOpenSSL (tested with 0.13)
* ndg-httpsclient (tested with 0.3.2)
* pyasn1 (tested with 0.1.6)

To activate it call :func:`~urllib3.contrib.pyopenssl.inject_into_urllib3`.
This can be done in a ``sitecustomize`` module, or at any other time before
your application begins using ``urllib3``, like this::

    try:
        import urllib3.contrib.pyopenssl
        urllib3.contrib.pyopenssl.inject_into_urllib3()
    except ImportError:
        pass

Now you can use :mod:`urllib3` as you normally would, and it will support SNI
when the required modules are installed.

Activating this module also has the positive side effect of disabling SSL/TLS
encryption in Python 2 (see `CRIME attack`_).

If you want to configure the default list of supported cipher suites, you can
set the ``urllib3.contrib.pyopenssl.DEFAULT_SSL_CIPHER_LIST`` variable.

Module Variables
----------------

:var DEFAULT_SSL_CIPHER_LIST: The list of supported SSL/TLS cipher suites.
    Default: ``EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA256
    EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EDH+aRSA EECDH RC4 !aNULL !eNULL !LOW !3DES
    !MD5 !EXP !PSK !SRP !DSS'``

.. _sni: https://en.wikipedia.org/wiki/Server_Name_Indication
.. _crime attack: https://en.wikipedia.org/wiki/CRIME_(security_exploit)

 ndg.httpsclient.ssl_peer_verification SUBJ_ALT_NAME_SUPPORT ndg.httpsclient.subj_alt_name SubjectAltName BaseSubjectAltName N/A OpenSSL.SSL pyasn1.codec.der decoder der_decoder pyasn1.type univ constraint socket _fileobject N/A ssl N/A select cStringIO StringIO N/A connection N/A util N/A __all__ N/A inject_into_urllib3 extract_from_urllib3 N/A HAS_SNI SUBJ_ALT_NAME_SUPPORT N/A _openssl_versions N/A N/A ssl PROTOCOL_SSLv23 N/A ssl PROTOCOL_SSLv3 N/A ssl PROTOCOL_TLSv1 N/A N/A OpenSSL SSL SSLv23_METHOD N/A N/A OpenSSL SSL SSLv3_METHOD N/A N/A OpenSSL SSL TLSv1_METHOD N/A _openssl_verify N/A N/A ssl CERT_NONE N/A ssl CERT_OPTIONAL N/A ssl CERT_REQUIRED N/A N/A OpenSSL SSL VERIFY_NONE N/A N/A OpenSSL SSL VERIFY_PEER N/A N/A N/A OpenSSL SSL VERIFY_PEER N/A N/A OpenSSL SSL VERIFY_FAIL_IF_NO_PEER_CERT N/A DEFAULT_SSL_CIPHER_LIST N/A N/A EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM  EECDH+ECDSA+SHA256 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EDH+aRSA  EECDH RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS N/A orig_util_HAS_SNI N/A util HAS_SNI N/A orig_connection_ssl_wrap_socket N/A connection ssl_wrap_socket inject_into_urllib3 N/A N/A N/A N/A N/A Monkey-patch urllib3 with PyOpenSSL-backed SSL-support. N/A N/A connection ssl_wrap_socket ssl_wrap_socket N/A N/A util HAS_SNI HAS_SNI N/A extract_from_urllib3 N/A N/A N/A N/A N/A Undo monkey-patching by :func:`inject_into_urllib3`. N/A N/A connection ssl_wrap_socket orig_connection_ssl_wrap_socket N/A N/A util HAS_SNI orig_util_HAS_SNI N/A SubjectAltName N/A BaseSubjectAltName N/A N/A ASN.1 implementation for subjectAltNames support N/A sizeSpec N/A N/A N/A univ SequenceOf sizeSpec N/A N/A constraint ValueSizeConstraint 1 1024 N/A get_subj_alt_name N/A N/A peer_cert N/A N/A N/A dns_name N/A N/A N/A SUBJ_ALT_NAME_SUPPORT N/A N/A dns_name N/A general_names N/A SubjectAltName N/A i N/A range N/A N/A peer_cert get_extension_count N/A N/A ext N/A N/A peer_cert get_extension i N/A ext_name N/A N/A ext get_short_name N/A N/A ext_name subjectAltName N/A N/A N/A ext_dat N/A N/A ext get_data N/A decoded_dat N/A N/A der_decoder decode ext_dat asn1Spec general_names N/A name decoded_dat N/A N/A N/A N/A isinstance name SubjectAltName N/A N/A N/A entry N/A range N/A len name N/A N/A component N/A N/A name getComponentByPosition entry N/A N/A N/A N/A component getName dNSName N/A N/A N/A N/A N/A dns_name append N/A str N/A N/A component getComponent N/A dns_name N/A fileobject N/A _fileobject N/A read N/A N/A self size N/A -1 N/A N/A rbufsize N/A max N/A self _rbufsize N/A self default_bufsize N/A buf N/A self _rbuf N/A N/A N/A buf seek 0 2 N/A N/A size 0 N/A N/A N/A self _rbuf N/A StringIO N/A True N/A N/A N/A N/A data N/A N/A N/A self _sock recv rbufsize N/A N/A N/A N/A N/A OpenSSL SSL WantReadError N/A N/A N/A N/A data N/A N/A N/A N/A N/A buf write data N/A N/A N/A buf getvalue N/A N/A buf_len N/A N/A buf tell N/A N/A buf_len size N/A N/A N/A N/A buf seek 0 N/A rv N/A N/A buf read size N/A N/A self _rbuf N/A StringIO N/A N/A N/A N/A self _rbuf write N/A N/A buf read N/A rv N/A N/A self _rbuf N/A StringIO N/A True N/A N/A left N/A size buf_len N/A N/A N/A data N/A N/A N/A self _sock recv left N/A N/A N/A N/A N/A OpenSSL SSL WantReadError N/A N/A N/A N/A data N/A N/A N/A n N/A len data N/A N/A N/A n size N/A buf_len N/A N/A data N/A N/A n left N/A N/A N/A N/A buf write data N/A data N/A N/A N/A n left N/A recv(%d) returned %d bytes N/A left n N/A N/A N/A buf write data N/A buf_len n N/A data N/A N/A N/A buf getvalue N/A readline N/A N/A self size N/A -1 N/A N/A buf N/A self _rbuf N/A N/A N/A buf seek 0 2 N/A N/A N/A N/A buf tell 0 N/A N/A N/A N/A buf seek 0 N/A bline N/A N/A buf readline size N/A N/A N/A N/A bline endswith N/A N/A len bline size N/A N/A N/A self _rbuf N/A StringIO N/A N/A N/A N/A self _rbuf write N/A N/A buf read N/A bline N/A bline N/A N/A size 0 N/A N/A N/A N/A self _rbufsize 1 N/A N/A N/A N/A buf seek 0 N/A buffers N/A N/A N/A buf read N/A N/A self _rbuf N/A StringIO N/A data None N/A recv N/A N/A self _sock recv N/A True N/A N/A N/A N/A N/A data N/A N/A data N/A recv 1 N/A N/A data N/A N/A N/A N/A N/A buffers append data N/A N/A N/A N/A N/A OpenSSL SSL WantReadError N/A N/A N/A N/A N/A N/A join buffers N/A N/A N/A buf seek 0 2 N/A N/A self _rbuf N/A StringIO N/A True N/A N/A N/A N/A data N/A N/A N/A self _sock recv N/A self _rbufsize N/A N/A N/A N/A N/A OpenSSL SSL WantReadError N/A N/A N/A N/A data N/A N/A N/A nl N/A N/A data find N/A N/A nl 0 N/A N/A nl 1 N/A N/A N/A buf write N/A data N/A nl N/A N/A N/A N/A self _rbuf write N/A data N/A nl N/A data N/A N/A N/A N/A buf write data N/A N/A N/A buf getvalue N/A N/A N/A N/A buf seek 0 2 N/A buf_len N/A N/A buf tell N/A N/A buf_len size N/A N/A N/A N/A buf seek 0 N/A rv N/A N/A buf read size N/A N/A self _rbuf N/A StringIO N/A N/A N/A N/A self _rbuf write N/A N/A buf read N/A rv N/A N/A self _rbuf N/A StringIO N/A True N/A N/A N/A N/A data N/A N/A N/A self _sock recv N/A self _rbufsize N/A N/A N/A N/A N/A OpenSSL SSL WantReadError N/A N/A N/A N/A data N/A N/A N/A left N/A size buf_len N/A nl N/A N/A data find 0 left N/A N/A nl 0 N/A N/A nl 1 N/A N/A N/A N/A self _rbuf write N/A data N/A nl N/A buf_len N/A N/A N/A N/A buf write N/A data N/A nl N/A N/A N/A N/A data N/A nl N/A n N/A len data N/A N/A N/A n size N/A buf_len N/A N/A data N/A N/A n left N/A N/A N/A N/A buf write N/A data N/A left N/A N/A N/A N/A self _rbuf write N/A data N/A left N/A N/A N/A N/A buf write data N/A buf_len n N/A N/A N/A buf getvalue N/A N/A WrappedSocket N/A object N/A N/A API-compatibility wrapper for Python OpenSSL's Connection-class. __init__ N/A N/A self connection socket N/A N/A N/A N/A self connection connection N/A N/A self socket socket N/A fileno N/A N/A self N/A N/A N/A N/A N/A N/A self socket fileno N/A makefile N/A N/A self mode bufsize N/A -1 N/A N/A N/A fileobject N/A self connection mode bufsize N/A settimeout N/A N/A self timeout N/A N/A N/A N/A N/A N/A self socket settimeout timeout N/A sendall N/A N/A self data N/A N/A N/A N/A N/A N/A self connection sendall data N/A close N/A N/A self N/A N/A N/A N/A N/A N/A self connection shutdown N/A getpeercert N/A N/A self binary_form N/A False N/A N/A x509 N/A N/A N/A self connection get_peer_certificate N/A N/A x509 N/A N/A x509 N/A binary_form N/A N/A N/A N/A N/A OpenSSL crypto dump_certificate N/A N/A OpenSSL crypto FILETYPE_ASN1 x509 N/A N/A subject subjectAltName N/A N/A N/A commonName N/A N/A N/A x509 get_subject CN N/A N/A DNS value N/A value N/A get_subj_alt_name x509 N/A N/A _verify_callback N/A N/A cnx x509 err_no err_depth return_code N/A N/A N/A N/A err_no 0 N/A ssl_wrap_socket N/A N/A sock keyfile certfile cert_reqs ca_certs server_hostname ssl_version N/A None None None None None None N/A N/A ctx N/A N/A N/A OpenSSL SSL Context N/A _openssl_versions N/A ssl_version N/A certfile N/A N/A N/A N/A ctx use_certificate_file certfile N/A keyfile N/A N/A N/A N/A ctx use_privatekey_file keyfile N/A N/A cert_reqs N/A ssl CERT_NONE N/A N/A N/A N/A ctx set_verify N/A _openssl_verify N/A cert_reqs _verify_callback N/A ca_certs N/A N/A N/A N/A N/A N/A ctx load_verify_locations ca_certs None N/A N/A N/A N/A N/A OpenSSL SSL Error N/A e N/A N/A N/A N/A ssl SSLError N/A bad ca_certs: %r ca_certs e N/A OP_NO_COMPRESSION 131072 N/A N/A N/A ctx set_options OP_NO_COMPRESSION N/A N/A N/A ctx set_cipher_list DEFAULT_SSL_CIPHER_LIST N/A cnx N/A N/A N/A OpenSSL SSL Connection ctx sock N/A N/A N/A cnx set_tlsext_host_name server_hostname N/A N/A N/A cnx set_connect_state N/A True N/A N/A N/A N/A N/A N/A cnx do_handshake N/A N/A N/A N/A N/A OpenSSL SSL WantReadError N/A N/A N/A N/A select select N/A sock N/A N/A N/A N/A N/A N/A N/A OpenSSL SSL Error N/A e N/A N/A N/A N/A ssl SSLError bad handshake e N/A N/A N/A WrappedSocket cnx sock N/A