def addAction(self, jsonStr): tempAction = json.loads(jsonStr) #Storing JSON in a python dictionary try: action = Action(tempAction['action'], tempAction['time']) except Exception as ex: logging.exception('Caught an error') print("Couldn't create Action object") print( "Added JSON object must have two ONLY keys, 'action' and 'time'" ) return # Check if action exists in actions dictionary, if it does update avgTime and numActions, else add to the dictionary if (self.__doesExist(tempAction) == True): print("updating old action") self.actions[action.getAction()].updateAction( action.getTime() ) # Updating the current object in the dictionary to have proper numActions and avgTime else: print("inserting new action") self.actions.update({action.getAction(): action})