Add ssl client certificate support

pull/30/head
Richard van den Berg 2016-08-26 09:11:01 +02:00
parent 0dbf7564ec
commit a1a524c2c5
1 changed files with 3 additions and 1 deletions

View File

@ -106,7 +106,7 @@ class PyMISP(object):
threat_level = threat_level
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:
raise NoURL('Please provide the URL of your MISP instance.')
if not key:
@ -116,6 +116,7 @@ class PyMISP(object):
self.key = key
self.ssl = ssl
self.proxies = proxies
self.cert = cert
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')
self.debug = debug
@ -146,6 +147,7 @@ class PyMISP(object):
session = requests.Session()
session.verify = self.ssl
session.proxies = self.proxies
session.cert = self.cert
session.headers.update(
{'Authorization': self.key,
'Accept': 'application/{}'.format(output),