Skip to content

Commit

Permalink
fix paths in getImagesTBA.py file
Browse files Browse the repository at this point in the history
  • Loading branch information
00magikarp committed Jul 25, 2024
1 parent fa63bee commit edb3274
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions scoutingapp/src/getImagesTBA.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
import time
import requests

TBA_API_KEY = r''
IMGUR_CLIENT_ID = r''
IMGUR_ETAG = r''
EVENT_KEY = r''
TBA_API_KEY = r'dS7Ml2ahEbgM5wV8mMKpHGx1Fxo9gUEgP10GersQaahJGqif0P2tHN1SBzCoPhdc'
IMGUR_CLIENT_ID = r'e6b25fcb319d82d'
IMGUR_ETAG = r'W/"12715af20eb36231834f51357e0d0690f2e54a7e"'
EVENT_KEY = r'2024cur'

if not (TBA_API_KEY and IMGUR_CLIENT_ID and IMGUR_ETAG and EVENT_KEY):
raise PermissionError("Some keys are missing! Go into code and insert your keys.")

FOLDER_PATH = './src/components/img'
FOLDER_PATH = './components/img'

# Headers for the API request
TBA_HEADERS = {
Expand Down Expand Up @@ -41,7 +41,7 @@ def fetch_teams(event_key) -> list[int]:
return sorted([team['team_number'] for team in response.json()])


def scrape_robot_image(team_number: int) -> str:
def scrape_robot_url(team_number: int) -> str:
"""
Returns the url of the location of the robot image used on TBA.
This function fails (raises TypeError or returns None) when there is no robot image found on TBA.
Expand Down Expand Up @@ -114,8 +114,8 @@ def main(teams: tuple[int] = ()) -> None:
time.sleep(2)

try:
url = scrape_robot_image(team)
print(f"{team}: scrape_robot_image ran successfully.")
url = scrape_robot_url(team)
print(f"{team}: URL grabbed successfully.")

if not url:
print(f"{team}: Failed to retrieve image link.")
Expand Down Expand Up @@ -143,7 +143,7 @@ def main(teams: tuple[int] = ()) -> None:
print("NOTE: Some teams did not run properly.")
print(*failed_teams.items(), sep="\n")

with open("./src/image_errors.txt", 'w') as err_file:
with open("./image_errors.txt", 'w') as err_file:
for fail in failed_teams.items():
err_file.write(str(fail) + "\n")

Expand Down

0 comments on commit edb3274

Please sign in to comment.