Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _validate_id(self, id_type: str):
print("[bold blue]Validating URL[/bold blue]")
if id_type == "participant":
url = f"{base_api_url}/participants/{self.ui.lineEditParticipantID.text()}"
valid_url = extralife_io.validate_url(url)
if valid_url:
message_box = QMessageBox.information(self, "Participant ID Validation",
f"Able to reach {url}. Participant ID is valid.")
else:
message_box = QMessageBox.warning(self, "Participant ID Validation",
f"Could not reach {url}. Participant ID may be invalid.")
elif id_type == "team":
url = f"{base_api_url}/teams/{self.ui.lineEditTeamID.text()}"
valid_url = extralife_io.validate_url(url)
if valid_url:
message_box = QMessageBox.information(self, "Team ID Validation",
f"Able to reach {url}. Team ID is valid.")
else:
message_box = QMessageBox.warning(self, "Team ID Validation",
f"Could not reach {url}. Team ID may be invalid.")
def __init__(self, participant_conf):
"""Load in config from participant.conf and creates the URLs."""
(self.extralife_id, self.text_folder,
self.currency_symbol, self.team_id,
self.donors_to_display) = participant_conf.get_cli_values()
# urls
self.participant_url = f"{base_api_url}/participants/{self.extralife_id}"
self.donation_url = f"{self.participant_url}/donations"
self.participant_donor_url = f"{self.participant_url}/donors"
# Participant Information
self.total_raised: int = 0
self.number_of_donations: int = 0
self.average_donation: int = 0
self.goal: int = 0
# the following need to be implemented in self._get_participant_info:
self.event_name: str = ""
self.donation_link_url: str = ""
self.stream_url: str = ""
self.extra_life_page_url: str = ""
self.created_date_utc: str = ""
self.team_name: str = ""
self.avatar_image_url: str = ""
def __init__(self, team_id: str, folder: str, currency_symbol: str):
"""Set the team variables."""
self.team_id = team_id
# urls
team_url_base: str = f"{base_api_url}/teams/"
self.team_url: str = f"{team_url_base}{team_id}"
self.team_participant_url: str = f"{self.team_url}/participants"
# misc
self.output_folder: str = folder
self.currency_symbol: str = currency_symbol
self.team_info = {}
self.participant_calculation_dict: dict = {}
self.top_5_participant_list = []
self.team_json = 0 # this needs to be changed in a refactor - shouldn't hold an int OR a dict