Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 5 additions & 6 deletions msa_sdk/msa_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from msa_sdk import constants
from msa_sdk import context
from msa_sdk.variables import Variables

logger = logging.getLogger("msa-sdk")

Expand Down Expand Up @@ -93,7 +92,7 @@ def task_error(cls, comment, context, log_response=True):
----------
comment: String
Comment
new_params: Dictionary
context: Dictionary
Context
log_response: Bool
Write log to a file
Expand All @@ -117,7 +116,7 @@ def task_success(cls, comment, context, log_response=True):
----------
comment: String
Comment
new_params: Dictionary
context: Dictionary
Context
log_response: Bool
Write log to a file
Expand Down Expand Up @@ -193,10 +192,10 @@ def _call_post(self, data=None, timeout=60):
if data is None:
data = {}

if isinstance(data, dict):
if isinstance(data, (dict, list)):
data = json.dumps(data)
else:
raise TypeError('Parameters needs to be a dictionary')
raise TypeError('Parameters needs to be a dictionary or a list')

url = self.url + self.path
self.response = requests.post(url, headers=headers, data=data,
Expand Down Expand Up @@ -286,7 +285,7 @@ def add_trace_headers(self, headers):
headers['X-B3-TraceId'] = context['TRACEID']
headers['X-B3-SpanId'] = context['SPANID']

def log_to_process_file(self, processId: str, log_message: str) -> bool:
def log_to_process_file(self, process_id: str, log_message: str) -> bool:
"""

Write log string with ISO timestamp to process log file.
Expand Down
29 changes: 29 additions & 0 deletions msa_sdk/pops.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""Module Pops."""

from msa_sdk.msa_api import MSA_API


class Pops(MSA_API):
"""Class Pops."""

def __init__(self):
"""Initialize."""
MSA_API.__init__(self)
self.api_path = "/sase/pops"

def save_pops(self, data):
"""
Save all pops.

Parameters
----------
data: pops data in json

Returns
-------
None

"""
self.action = 'Save Pops'
self.path = '{}'.format(self.api_path)
self._call_post(data)