Passed
Push — main ( b508f6...84f6d4 )
by Sat CFDI
05:19
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
from requests.adapters import HTTPAdapter
3 1
from urllib3.util import create_urllib3_context
4
5 1
CIPHERS = (
6
    'ECDHE+AESGCM:ECDHE+CHACHA20:DHE+AESGCM:DHE+CHACHA20:ECDH+AESGCM:'
7
    'DH+AESGCM:ECDH+AES:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!eNULL:!MD5:!DSS'
8
    ':HIGH:!DH'
9
)
10
11
12 1
class SSLAdapter(HTTPAdapter):
13 1
    def init_poolmanager(self, *args, **kwargs):
14 1
        kwargs['ssl_context'] = create_urllib3_context(ciphers=CIPHERS)
15 1
        return super().init_poolmanager(*args, **kwargs)
16
17 1
    def proxy_manager_for(self, *args, **kwargs):
18
        kwargs['ssl_context'] = create_urllib3_context(ciphers=CIPHERS)
19
        return super().proxy_manager_for(*args, **kwargs)
20