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 34
34
from .route import Route
35
35
from .status import BAD_REQUEST_400 , FORBIDDEN_403 , NOT_FOUND_404 , UNAUTHORIZED_401
36
36
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
39
51
40
52
41
53
NO_REQUEST = "no_request"
@@ -129,6 +141,8 @@ def __init__(
129
141
self .https = https
130
142
131
143
if https :
144
+ if not SSL_AVAILABLE :
145
+ raise NotImplementedError ("SSL not available on this platform" )
132
146
self ._validate_https_cert_provided (certfile , keyfile )
133
147
self ._ssl_context = self ._create_ssl_context (certfile , keyfile )
134
148
else :
You can’t perform that action at this time.
0 commit comments