mirror of https://github.com/MISP/PyMISP
Add ssl client certificate support
parent
0dbf7564ec
commit
a1a524c2c5
|
@ -106,7 +106,7 @@ class PyMISP(object):
|
||||||
threat_level = threat_level
|
threat_level = threat_level
|
||||||
analysis = analysis
|
analysis = analysis
|
||||||
|
|
||||||
def __init__(self, url, key, ssl=True, out_type='json', debug=False, proxies=None):
|
def __init__(self, url, key, ssl=True, out_type='json', debug=False, proxies=None, cert=None):
|
||||||
if not url:
|
if not url:
|
||||||
raise NoURL('Please provide the URL of your MISP instance.')
|
raise NoURL('Please provide the URL of your MISP instance.')
|
||||||
if not key:
|
if not key:
|
||||||
|
@ -116,6 +116,7 @@ class PyMISP(object):
|
||||||
self.key = key
|
self.key = key
|
||||||
self.ssl = ssl
|
self.ssl = ssl
|
||||||
self.proxies = proxies
|
self.proxies = proxies
|
||||||
|
self.cert = cert
|
||||||
if out_type != 'json':
|
if out_type != 'json':
|
||||||
raise PyMISPError('The only output type supported by PyMISP is JSON. If you still rely on XML, use PyMISP v2.4.49')
|
raise PyMISPError('The only output type supported by PyMISP is JSON. If you still rely on XML, use PyMISP v2.4.49')
|
||||||
self.debug = debug
|
self.debug = debug
|
||||||
|
@ -146,6 +147,7 @@ class PyMISP(object):
|
||||||
session = requests.Session()
|
session = requests.Session()
|
||||||
session.verify = self.ssl
|
session.verify = self.ssl
|
||||||
session.proxies = self.proxies
|
session.proxies = self.proxies
|
||||||
|
session.cert = self.cert
|
||||||
session.headers.update(
|
session.headers.update(
|
||||||
{'Authorization': self.key,
|
{'Authorization': self.key,
|
||||||
'Accept': 'application/{}'.format(output),
|
'Accept': 'application/{}'.format(output),
|
||||||
|
|
Loading…
Reference in New Issue