Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_team_json(self):
"""Get team info from JSON api."""
self.team_json = extralife_IO.get_JSON(self.team_url)
if self.team_json == 0:
print("Could not get team JSON")
else:
self.team_goal = self.team_json["fundraisingGoal"]
self.team_captain = self.team_json["captainDisplayName"]
self.total_raised = self.team_json["sumDonations"]
self.num_donations = self.team_json["numDonations"]
# dictionary
self.team_info["Team_goal"] = f"{self.currency_symbol}{self.team_goal:,.2f}"
self.team_info["Team_captain"] = f"{self.team_captain}"
self.team_info["Team_totalRaised"] = f"{self.currency_symbol}{self.total_raised:,.2f}"
self.team_info["Team_numDonations"] = f"{self.num_donations}"
def get_top_5_participants(self):
"""Get team participants."""
self.top5_team_participant_json = extralife_IO.get_JSON(self.team_participant_url, True)
if self.top5_team_participant_json == 0:
print("Couldn't get top 5 team participants")
elif len(self.top5_team_participant_json) == 0:
print("No team participants!")
else:
self.top_5_participant_list = [TeamParticipant(self.top5_team_participant_json[participant]) for participant in range(0, len(self.top5_team_participant_json))]