HEX
Server: Apache/2.4.41 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40
System: Linux ip-172-31-40-18 4.14.146-93.123.amzn1.x86_64 #1 SMP Tue Sep 24 00:45:23 UTC 2019 x86_64
User: apache (48)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: //usr/local/ngfot/letsencrypt/acme/acme/__init__.py
"""ACME protocol implementation.

This module is an implementation of the `ACME protocol`_.

.. _`ACME protocol`: https://ietf-wg-acme.github.io/acme

"""
import sys
import warnings

# This code exists to keep backwards compatibility with people using acme.jose
# before it became the standalone josepy package.
#
# It is based on
# https://github.com/requests/requests/blob/1278ecdf71a312dc2268f3bfc0aabfab3c006dcf/requests/packages.py

import josepy as jose

for mod in list(sys.modules):
    # This traversal is apparently necessary such that the identities are
    # preserved (acme.jose.* is josepy.*)
    if mod == 'josepy' or mod.startswith('josepy.'):
        sys.modules['acme.' + mod.replace('josepy', 'jose', 1)] = sys.modules[mod]


# This class takes a similar approach to the cryptography project to deprecate attributes
# in public modules. See the _ModuleWithDeprecation class here:
# https://github.com/pyca/cryptography/blob/91105952739442a74582d3e62b3d2111365b0dc7/src/cryptography/utils.py#L129
class _TLSSNI01DeprecationModule(object):
    """
    Internal class delegating to a module, and displaying warnings when
    attributes related to TLS-SNI-01 are accessed.
    """
    def __init__(self, module):
        self.__dict__['_module'] = module

    def __getattr__(self, attr):
        if 'TLSSNI01' in attr or attr == 'BaseRequestHandlerWithLogging':
            warnings.warn('{0} attribute is deprecated, and will be removed soon.'.format(attr),
                          DeprecationWarning, stacklevel=2)
        return getattr(self._module, attr)

    def __setattr__(self, attr, value):  # pragma: no cover
        setattr(self._module, attr, value)

    def __delattr__(self, attr):  # pragma: no cover
        delattr(self._module, attr)

    def __dir__(self):  # pragma: no cover
        return ['_module'] + dir(self._module)

if sys.version_info[:2] == (3, 4):
    warnings.warn(
            "Python 3.4 support will be dropped in the next release of "
            "acme. Please upgrade your Python version.",
            PendingDeprecationWarning,
    ) # pragma: no cover