Add support for proxies in the library.

Fix #48
pull/24/head
Raphaël Vinot 2016-07-28 09:49:40 +02:00
parent ce00a01521
commit f45490b02e
1 changed files with 3 additions and 1 deletions

View File

@ -93,7 +93,7 @@ class PyMISP(object):
:param out_type: Type of object (json or xml)
"""
def __init__(self, url, key, ssl=True, out_type='json', debug=False):
def __init__(self, url, key, ssl=True, out_type='json', debug=False, proxies=None):
if not url:
raise NoURL('Please provide the URL of your MISP instance.')
if not key:
@ -102,6 +102,7 @@ class PyMISP(object):
self.root_url = url
self.key = key
self.ssl = ssl
self.proxies = proxies
self.out_type = out_type
self.debug = debug
@ -134,6 +135,7 @@ class PyMISP(object):
out = self.out_type
session = requests.Session()
session.verify = self.ssl
session.proxies = self.proxies
session.headers.update(
{'Authorization': self.key,
'Accept': 'application/' + out,