Add checkpoint_session module (#50930)

* Add checkpoint_session module

* Add unit test

* Fix pep8

* Rename Checkpoint for Check Point
This commit is contained in:
Ricardo Carrillo Cruz 2019-01-16 13:19:36 +01:00 committed by GitHub
parent 2135ddf233
commit ac61c99821
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 188 additions and 3 deletions

View file

@ -40,6 +40,7 @@ class HttpApi(HttpApiBase):
try:
self.connection._auth = {'X-chkp-sid': response_data['sid']}
self.connection._session_uid = response_data['uid']
except KeyError:
raise ConnectionError(
'Server returned response without token info during connection authentication: %s' % response)
@ -49,8 +50,8 @@ class HttpApi(HttpApiBase):
response, dummy = self.send_request(url, None)
def get_sid(self):
return self.connection._auth['X-chkp-sid']
def get_session_uid(self):
return self.connection._session_uid
def send_request(self, path, body_params):
data = json.dumps(body_params) if body_params else '{}'