Skip to content

Commit

Permalink
Merge pull request #332 from forta-network/fix-python-finding-unique-key
Browse files Browse the repository at this point in the history
fix python finding unique key
  • Loading branch information
haseebrabbani committed Aug 21, 2023
2 parents fb0266d + c289f61 commit 0c115e9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python-sdk/src/forta_agent/finding.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ def __init__(self, dict):
self.type = dict['type']
self.metadata = dict.get('metadata')
self.addresses = dict.get('addresses')
self.labels = list(map(lambda l: l if isinstance(l, Label) else Label(l), dict.get('labels', [])))
self.labels = list(map(lambda l: l if isinstance(
l, Label) else Label(l), dict.get('labels', [])))
self.unique_key = dict.get('unique_key')
self.source = dict.get('source')

def toJson(self):
d = dict(self.__dict__, **{
'alertId': self.alert_id,
'labels': list(map(lambda l: l.toDict(), self.labels))
'labels': list(map(lambda l: l.toDict(), self.labels)),
'uniqueKey': self.unique_key
})
return json.dumps({k: v for k, v in d.items() if v or k == 'type' or k == 'severity'})

0 comments on commit 0c115e9

Please sign in to comment.