OLD | NEW |
(Empty) | |
| 1 import sys |
| 2 |
| 3 try: |
| 4 # Our match_hostname function is the same as 3.5's, so we only want to |
| 5 # import the match_hostname function if it's at least that good. |
| 6 if sys.version_info < (3, 5): |
| 7 raise ImportError("Fallback to vendored code") |
| 8 |
| 9 from ssl import CertificateError, match_hostname |
| 10 except ImportError: |
| 11 try: |
| 12 # Backport of the function from a pypi module |
| 13 from backports.ssl_match_hostname import CertificateError, match_hostnam
e |
| 14 except ImportError: |
| 15 # Our vendored copy |
| 16 from ._implementation import CertificateError, match_hostname |
| 17 |
| 18 # Not needed, but documenting what we provide. |
| 19 __all__ = ('CertificateError', 'match_hostname') |
OLD | NEW |