Skip to content

Commit

Permalink
auto-adjust for year by event code
Browse files Browse the repository at this point in the history
  • Loading branch information
00magikarp committed Mar 1, 2025
1 parent ca04a0d commit df8e9ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions scoutingapp/src/config/structure.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
"id": "TeamNumber",
"required": true
},
{
"type": "RobotImage"
},
{
"type": "Spacing"
},
Expand Down
12 changes: 6 additions & 6 deletions scoutingapp/src/getImagesTBA.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import time
import requests

TBA_API_KEY = r''
IMGUR_CLIENT_ID = r''
IMGUR_ETAG = r''
EVENT_KEY = r''
TBA_API_KEY = r'zFwttaDMMWBKxjXaPSsMJK14pMvwYfgulFeeMermxHqnjuBMQll6hkV7mBl39jDa'
IMGUR_CLIENT_ID = r'e6b25fcb319d82d'
IMGUR_ETAG = r'W/"12715af20eb36231834f51357e0d0690f2e54a7e"'
EVENT_KEY = r'2025vapor'

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.")
Expand Down Expand Up @@ -50,7 +50,7 @@ def scrape_robot_url(team_number: int) -> str:
:returns: The url of the image
"""

url = f'https://www.thebluealliance.com/api/v3/team/frc{team_number}/media/2024'
url = f'https://www.thebluealliance.com/api/v3/team/frc{team_number}/media/{EVENT_KEY[:4]}'
response = requests.get(url, headers=TBA_HEADERS)
response.raise_for_status()
data = [x for x in response.json() if x['type'] not in ['avatar', 'youtube']]
Expand Down Expand Up @@ -111,7 +111,7 @@ def main(teams: tuple[int] = ()) -> None:
failed_teams = {}
for team in teams:
print(f'{team}: Starting...')
time.sleep(2)
time.sleep(2) # anti 429

try:
url = scrape_robot_url(team)
Expand Down

0 comments on commit df8e9ce

Please sign in to comment.