Passed
Push — main ( b508f6...84f6d4 )
by Sat CFDI
05:19
created

satcfdi.sat_requests_utils   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 20
ccs 8
cts 10
cp 0.8
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A SSLAdapter.proxy_manager_for() 0 3 1
A SSLAdapter.init_poolmanager() 0 3 1
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