Passed
Push — main ( f9007a...25883c )
by Sat CFDI
06:03
created

SSLAdapter.init_poolmanager()   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 3
dl 0
loc 3
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
# Ciphers compatible with SAT Services
2 1
import ssl
3
4 1
import certifi
5 1
from requests.adapters import HTTPAdapter
6
7 1
CIPHERS = (
8
    'ECDHE+AESGCM:ECDHE+CHACHA20:DHE+AESGCM:DHE+CHACHA20:ECDH+AESGCM:'
9
    'DH+AESGCM:ECDH+AES:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!eNULL:!MD5:!DSS'
10
    ':HIGH:!DH'
11
)
12
13 1
ssl_context = ssl.create_default_context(cafile=certifi.where())
14 1
ssl_context.set_ciphers(CIPHERS)
15
16
17 1
class SSLAdapter(HTTPAdapter):
18 1
    def init_poolmanager(self, *args, **kwargs):
19 1
        kwargs['ssl_context'] = ssl_context
20 1
        return super().init_poolmanager(*args, **kwargs)
21
22 1
    def proxy_manager_for(self, *args, **kwargs):
23
        kwargs['ssl_context'] = ssl_context
24
        return super().proxy_manager_for(*args, **kwargs)
25