Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion phpipamsdk/phpipam.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def build_payload(objmap=None, **kwargs):

class PhpIpamException(Exception):
""" phpipam generic exception class """

def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)

Expand All @@ -33,6 +34,8 @@ class PhpIpamApi(object):
'content-type': 'application/json'
}

_phpipam_session = None

def __init__(self, api_uri=None, api_appcode=None, api_verify_ssl=None):
if api_uri is None:
self._api_uri = Configuration().api_uri
Expand All @@ -52,10 +55,12 @@ def __init__(self, api_uri=None, api_appcode=None, api_verify_ssl=None):
else:
self._api_verify_ssl = api_verify_ssl

self._phpipam_session = requests.Session()

def api_send_request(self, path='', method='', auth='', payload=None):
""" send HTTP REST request """
try:
response = requests.request(
response = self._phpipam_session.request(
method=method,
url=self._api_uri + path,
auth=auth,
Expand Down