1"""
2_ssl_compat.py
3websocket - WebSocket client library for Python
4
5Copyright 2024 engn33r
6
7Licensed under the Apache License, Version 2.0 (the "License");
8you may not use this file except in compliance with the License.
9You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0
12
13Unless required by applicable law or agreed to in writing, software
14distributed under the License is distributed on an "AS IS" BASIS,
15WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16See the License for the specific language governing permissions and
17limitations under the License.
18"""
19
20__all__ = [
21 "HAVE_SSL",
22 "ssl",
23 "SSLError",
24 "SSLEOFError",
25 "SSLWantReadError",
26 "SSLWantWriteError",
27]
28
29try:
30 import ssl
31 from ssl import SSLError, SSLEOFError, SSLWantReadError, SSLWantWriteError
32
33 HAVE_SSL = True
34except ImportError:
35 # dummy class of SSLError for environment without ssl support
36 class SSLError(Exception):
37 pass
38
39 class SSLEOFError(Exception):
40 pass
41
42 class SSLWantReadError(Exception):
43 pass
44
45 class SSLWantWriteError(Exception):
46 pass
47
48 ssl = None
49 HAVE_SSL = False