Skip to content

Commit

Permalink
#316 Use kwargs to build operations
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Jul 31, 2018
1 parent c90b744 commit a9392fa
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions contrib/cortexutils/responder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,26 @@
class Responder(Worker):

def __init__(self):
Worker.__init__(self)
Worker.__init__(self)

# Not breaking compatibility
self.artifact = self._input
self.artifact = self._input

def get_data(self):
"""Wrapper for getting data from input dict.
:return: Data (observable value) given through Cortex"""
return self.get_param('data', None, 'Missing data field')
return self.get_param('data', None, 'Missing data field')

def build_operation(self, op_type, parameters={}):
@staticmethod
def build_operation(op_type, **parameters):
"""
:param op_type: an operation type as a string
:param parameters: a dict including the operation's params
:param parameters: a dict including the operation's params
:return: dict
"""
operation = {
'type': op_type
'type': op_type
}
operation.update(parameters)

Expand Down

0 comments on commit a9392fa

Please sign in to comment.