gauravlochab commited on
Commit
1520dc2
·
1 Parent(s): 704f500

Refactor code to handle response_transfers with missing "transfers" key

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -94,7 +94,9 @@ def fetch_and_aggregate_transactions():
94
  if 25 in agent_ids:
95
  agent_address = service_registry.functions.getAgentInstances(service_id).call()[1][0]
96
  response_transfers = get_transfers("valory", agent_address)
97
- aggregated_transactions.extend(response_transfers["transfers"])
 
 
98
 
99
  # Track the daily number of agents
100
  creation_event = service_registry.events.CreateService.create_filter(
 
94
  if 25 in agent_ids:
95
  agent_address = service_registry.functions.getAgentInstances(service_id).call()[1][0]
96
  response_transfers = get_transfers("valory", agent_address)
97
+ transfers = response_transfers.get("transfers", [])
98
+ if isinstance(transfers, list):
99
+ aggregated_transactions.extend(transfers)
100
 
101
  # Track the daily number of agents
102
  creation_event = service_registry.events.CreateService.create_filter(