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_participant_info(self):
"""Get JSON data for participant information.
:returns: JSON data for self.total_raised, self.number_of_donations, and self.goal.
"""
participant_json = extralife_io.get_json(self.participant_url)
if not participant_json:
print("[bold red]Couldn't access participant JSON.[/bold red]")
return self.total_raised, self.number_of_donations, self.goal
else:
return participant_json['sumDonations'], participant_json['numDonations'],\
participant_json['fundraisingGoal']
def _get_top_donor(self):
"""Return Top Donor from server.
Uses donor drive's sorting to get the top guy or gal.
"""
top_donor_json = extralife_io.get_json(self.participant_donor_url, True)
if not top_donor_json:
print("[bold red] Couldn't access top donor data[/bold red]")
return self.top_donor
else:
return donor.Donor(top_donor_json[0])