diff --git a/adafruit_requests.py b/adafruit_requests.py index 20535d4..9b5bc00 100644 --- a/adafruit_requests.py +++ b/adafruit_requests.py @@ -47,11 +47,15 @@ def cast(_t, value): """No-op shim for the typing.cast() function which is not available in CircuitPython.""" return value - else: from ssl import SSLContext from types import ModuleType, TracebackType - from typing import Any, Dict, List, Optional, Protocol, Tuple, Type, Union, cast + from typing import Any, Dict, List, Optional, Tuple, Type, Union, cast + + try: + from typing import Protocol + except ImportError: + from typing_extensions import Protocol # Based on https://github.com/python/typeshed/blob/master/stdlib/_socket.pyi class CommonSocketType(Protocol):