fix(api): raise 403 on scouting auth failure instead of returning 200 (#213) #214

Merged
cal merged 1 commits from issue/213-fix-api-scouting-endpoints-return-200-on-auth-fail into main 2026-04-11 01:49:13 +00:00
2 changed files with 14 additions and 8 deletions

View File

@ -332,10 +332,13 @@ async def get_card_scouting(team_id: int, ts: str):
logging.debug(f"Team: {this_team} / has_guide: {this_team.has_guide}")
if this_team is None or ts != this_team.team_hash() or this_team.has_guide != 1:
logging.warning(f"Team_id {team_id} attempted to pull ratings")
return (
"Your team does not have the ratings guide enabled. If you have purchased a copy ping Cal to "
"make sure it is enabled on your team. If you are interested you can pick it up here (thank you!): "
"https://ko-fi.com/manticorum/shop"
raise HTTPException(
status_code=403,
detail=(
"Your team does not have the ratings guide enabled. If you have purchased a copy ping Cal to "
"make sure it is enabled on your team. If you are interested you can pick it up here (thank you!): "
"https://ko-fi.com/manticorum/shop"
),
)
if os.path.isfile("storage/batting-ratings.csv"):

View File

@ -252,10 +252,13 @@ async def get_card_scouting(team_id: int, ts: str):
logging.debug(f"Team: {this_team} / has_guide: {this_team.has_guide}")
if this_team is None or ts != this_team.team_hash() or this_team.has_guide != 1:
logging.warning(f"Team_id {team_id} attempted to pull ratings")
return (
"Your team does not have the ratings guide enabled. If you have purchased a copy ping Cal to "
"make sure it is enabled on your team. If you are interested you can pick it up here (thank you!): "
"https://ko-fi.com/manticorum/shop"
raise HTTPException(
status_code=403,
detail=(
"Your team does not have the ratings guide enabled. If you have purchased a copy ping Cal to "
"make sure it is enabled on your team. If you are interested you can pick it up here (thank you!): "
"https://ko-fi.com/manticorum/shop"
),
)
if os.path.isfile(RATINGS_FILE):