1"""ACME protocol implementation.
2
3This module is an implementation of the `ACME protocol`_.
4
5.. _`ACME protocol`: https://ietf-wg-acme.github.io/acme
6
7"""
8import sys
9
10# This code exists to keep backwards compatibility with people using acme.jose
11# before it became the standalone josepy package.
12#
13# It is based on
14# https://github.com/requests/requests/blob/1278ecdf71a312dc2268f3bfc0aabfab3c006dcf/requests/packages.py
15import josepy as jose
16
17for mod in list(sys.modules):
18    # This traversal is apparently necessary such that the identities are
19    # preserved (acme.jose.* is josepy.*)
20    if mod == 'josepy' or mod.startswith('josepy.'):
21        sys.modules['acme.' + mod.replace('josepy', 'jose', 1)] = sys.modules[mod]
22