File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 3434from .route import Route
3535from .status import BAD_REQUEST_400 , FORBIDDEN_403 , NOT_FOUND_404 , UNAUTHORIZED_401
3636
37- if implementation .name != "circuitpython" :
38- from ssl import CERT_NONE , Purpose , SSLError
37+ try :
38+ from ssl import SSLContext , create_default_context
39+
40+ try : # ssl imports for C python
41+ from ssl import (
42+ CERT_NONE ,
43+ Purpose ,
44+ SSLError ,
45+ )
46+ except ImportError :
47+ pass
48+ SSL_AVAILABLE = True
49+ except ImportError :
50+ SSL_AVAILABLE = False
3951
4052
4153NO_REQUEST = "no_request"
@@ -129,6 +141,8 @@ def __init__(
129141 self .https = https
130142
131143 if https :
144+ if not SSL_AVAILABLE :
145+ raise NotImplementedError ("SSL not available on this platform" )
132146 self ._validate_https_cert_provided (certfile , keyfile )
133147 self ._ssl_context = self ._create_ssl_context (certfile , keyfile )
134148 else :
You can’t perform that action at this time.
0 commit comments