File size: 1,502 Bytes
48e124a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import enum
from typing import Any

CERT_NONE = 0


class TLSVersion(enum.IntEnum):
    TLSv1_2 = 12


class WantReadException(Exception):
    pass


class WantWriteException(Exception):
    pass


class SSLWantReadError(Exception):
    pass


class SSLWantWriteError(Exception):
    pass


class SSLContext:
    def __init__(self) -> None:
        self.minimum_version: Any = TLSVersion.TLSv1_2
        self.check_hostname: bool = False
        self.verify_mode: int = CERT_NONE

    def wrap_socket(self, *args, **kwargs) -> "SSLSocket":  # type: ignore
        raise Exception("no ssl support")  # pylint: disable=broad-exception-raised

    def set_alpn_protocols(self, *args, **kwargs):  # type: ignore
        raise Exception("no ssl support")  # pylint: disable=broad-exception-raised


class SSLSocket:
    def pending(self) -> bool:
        raise Exception("no ssl support")  # pylint: disable=broad-exception-raised

    def do_handshake(self) -> None:
        raise Exception("no ssl support")  # pylint: disable=broad-exception-raised

    def settimeout(self, value: Any) -> None:
        pass

    def getpeercert(self) -> Any:
        raise Exception("no ssl support")  # pylint: disable=broad-exception-raised

    def __enter__(self):
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        return False


def create_default_context(*args, **kwargs) -> SSLContext:  # type: ignore
    raise Exception("no ssl support")  # pylint: disable=broad-exception-raised