fix: remove token value from Bad Token log messages (#35)
All checks were successful
Build Docker Image / build (pull_request) Successful in 2m6s

Replace f-string log messages that interpolate the raw bearer token with
static strings that omit the token value entirely. Affected 22 router files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2026-03-05 11:32:13 -06:00
parent ddf5f77da4
commit 4a8470cc7c
22 changed files with 73 additions and 73 deletions

View File

@ -87,7 +87,7 @@ async def patch_award(
image: Optional[str] = None, manager1_id: Optional[int] = None, manager2_id: Optional[int] = None,
player_id: Optional[int] = None, team_id: Optional[int] = None, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'patch_player - Bad Token: {token}')
logger.warning('patch_player - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_award = Award.get_or_none(Award.id == award_id)
@ -125,7 +125,7 @@ async def patch_award(
@handle_db_errors
async def post_award(award_list: AwardList, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'patch_player - Bad Token: {token}')
logger.warning('patch_player - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
new_awards = []
@ -153,7 +153,7 @@ async def post_award(award_list: AwardList, token: str = Depends(oauth2_scheme))
@handle_db_errors
async def delete_award(award_id: int, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'patch_player - Bad Token: {token}')
logger.warning('patch_player - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_award = Award.get_or_none(Award.id == award_id)

View File

@ -291,7 +291,7 @@ async def get_totalstats(
@handle_db_errors
async def patch_batstats(stat_id: int, new_stats: BatStatModel, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'patch_batstats - Bad Token: {token}')
logger.warning('patch_batstats - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
if BattingStat.get_or_none(BattingStat.id == stat_id) is None:
@ -307,7 +307,7 @@ async def patch_batstats(stat_id: int, new_stats: BatStatModel, token: str = Dep
@handle_db_errors
async def post_batstats(s_list: BatStatList, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'post_batstats - Bad Token: {token}')
logger.warning('post_batstats - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
all_stats = []

View File

@ -53,7 +53,7 @@ async def patch_current(
bet_week: Optional[int] = None, trade_deadline: Optional[int] = None, pick_trade_start: Optional[int] = None,
pick_trade_end: Optional[int] = None, injury_count: Optional[int] = None, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'patch_current - Bad Token: {token}')
logger.warning('patch_current - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
try:
@ -97,7 +97,7 @@ async def patch_current(
@handle_db_errors
async def post_current(new_current: CurrentModel, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'patch_current - Bad Token: {token}')
logger.warning('patch_current - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_current = Current(**new_current.dict())
@ -115,7 +115,7 @@ async def post_current(new_current: CurrentModel, token: str = Depends(oauth2_sc
@handle_db_errors
async def delete_current(current_id: int, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'patch_current - Bad Token: {token}')
logger.warning('patch_current - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
if Current.delete_by_id(current_id) == 1:

View File

@ -358,7 +358,7 @@ async def create_custom_command_endpoint(
):
"""Create a new custom command"""
if not valid_token(token):
logger.warning(f'create_custom_command - Bad Token: {token}')
logger.warning('create_custom_command - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
try:
@ -421,7 +421,7 @@ async def update_custom_command_endpoint(
):
"""Update an existing custom command"""
if not valid_token(token):
logger.warning(f'update_custom_command - Bad Token: {token}')
logger.warning('update_custom_command - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
try:
@ -487,7 +487,7 @@ async def patch_custom_command(
):
"""Partially update a custom command"""
if not valid_token(token):
logger.warning(f'patch_custom_command - Bad Token: {token}')
logger.warning('patch_custom_command - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
try:
@ -564,7 +564,7 @@ async def delete_custom_command_endpoint(
):
"""Delete a custom command"""
if not valid_token(token):
logger.warning(f'delete_custom_command - Bad Token: {token}')
logger.warning('delete_custom_command - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
try:
@ -667,7 +667,7 @@ async def create_creator_endpoint(
):
"""Create a new command creator"""
if not valid_token(token):
logger.warning(f'create_creator - Bad Token: {token}')
logger.warning('create_creator - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
try:
@ -870,7 +870,7 @@ async def execute_custom_command(
):
"""Execute a custom command and update usage statistics"""
if not valid_token(token):
logger.warning(f'execute_custom_command - Bad Token: {token}')
logger.warning('execute_custom_command - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
try:

View File

@ -130,7 +130,7 @@ async def patch_decision(
irunners_scored: Optional[int] = None, rest_ip: Optional[int] = None, rest_required: Optional[int] = None,
token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'patch_decision - Bad Token: {token}')
logger.warning('patch_decision - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_dec = Decision.get_or_none(Decision.id == decision_id)
@ -170,7 +170,7 @@ async def patch_decision(
@handle_db_errors
async def post_decisions(dec_list: DecisionList, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'post_decisions - Bad Token: {token}')
logger.warning('post_decisions - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
new_dec = []
@ -194,7 +194,7 @@ async def post_decisions(dec_list: DecisionList, token: str = Depends(oauth2_sch
@handle_db_errors
async def delete_decision(decision_id: int, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'delete_decision - Bad Token: {token}')
logger.warning('delete_decision - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_dec = Decision.get_or_none(Decision.id == decision_id)
@ -215,7 +215,7 @@ async def delete_decision(decision_id: int, token: str = Depends(oauth2_scheme))
@handle_db_errors
async def delete_decisions_game(game_id: int, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'delete_decisions_game - Bad Token: {token}')
logger.warning('delete_decisions_game - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_game = StratGame.get_or_none(StratGame.id == game_id)

View File

@ -65,7 +65,7 @@ async def patch_division(
division_id: int, div_name: Optional[str] = None, div_abbrev: Optional[str] = None,
lg_name: Optional[str] = None, lg_abbrev: Optional[str] = None, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'patch_division - Bad Token: {token}')
logger.warning('patch_division - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_div = Division.get_or_none(Division.id == division_id)
@ -95,7 +95,7 @@ async def patch_division(
@handle_db_errors
async def post_division(new_division: DivisionModel, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'post_division - Bad Token: {token}')
logger.warning('post_division - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_division = Division(**new_division.dict())
@ -113,7 +113,7 @@ async def post_division(new_division: DivisionModel, token: str = Depends(oauth2
@handle_db_errors
async def delete_division(division_id: int, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'delete_division - Bad Token: {token}')
logger.warning('delete_division - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_div = Division.get_or_none(Division.id == division_id)

View File

@ -45,7 +45,7 @@ async def patch_draftdata(
pick_deadline: Optional[datetime.datetime] = None, result_channel: Optional[int] = None,
ping_channel: Optional[int] = None, pick_minutes: Optional[int] = None, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'patch_draftdata - Bad Token: {token}')
logger.warning('patch_draftdata - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
draft_data = DraftData.get_or_none(DraftData.id == data_id)

View File

@ -31,7 +31,7 @@ class DraftListList(pydantic.BaseModel):
async def get_draftlist(
season: Optional[int], team_id: list = Query(default=None), token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'get_draftlist - Bad Token: {token}')
logger.warning('get_draftlist - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
all_list = DraftList.select()
@ -54,7 +54,7 @@ async def get_draftlist(
@handle_db_errors
async def get_team_draftlist(team_id: int, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'post_draftlist - Bad Token: {token}')
logger.warning('post_draftlist - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_team = Team.get_or_none(Team.id == team_id)
@ -75,7 +75,7 @@ async def get_team_draftlist(team_id: int, token: str = Depends(oauth2_scheme)):
@handle_db_errors
async def post_draftlist(draft_list: DraftListList, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'post_draftlist - Bad Token: {token}')
logger.warning('post_draftlist - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
new_list = []
@ -100,7 +100,7 @@ async def post_draftlist(draft_list: DraftListList, token: str = Depends(oauth2_
@handle_db_errors
async def delete_draftlist(team_id: int, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'delete_draftlist - Bad Token: {token}')
logger.warning('delete_draftlist - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
count = DraftList.delete().where(DraftList.team_id == team_id).execute()

View File

@ -121,7 +121,7 @@ async def get_one_pick(pick_id: int, short_output: Optional[bool] = False):
@handle_db_errors
async def patch_pick(pick_id: int, new_pick: DraftPickModel, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'patch_pick - Bad Token: {token}')
logger.warning('patch_pick - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
if DraftPick.get_or_none(DraftPick.id == pick_id) is None:
@ -137,7 +137,7 @@ async def patch_pick(pick_id: int, new_pick: DraftPickModel, token: str = Depend
@handle_db_errors
async def post_picks(p_list: DraftPickList, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'post_picks - Bad Token: {token}')
logger.warning('post_picks - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
new_picks = []
@ -164,7 +164,7 @@ async def post_picks(p_list: DraftPickList, token: str = Depends(oauth2_scheme))
@handle_db_errors
async def delete_pick(pick_id: int, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'delete_pick - Bad Token: {token}')
logger.warning('delete_pick - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_pick = DraftPick.get_or_none(DraftPick.id == pick_id)

View File

@ -147,7 +147,7 @@ async def create_help_command_endpoint(
):
"""Create a new help command"""
if not valid_token(token):
logger.warning(f'create_help_command - Bad Token: {token}')
logger.warning('create_help_command - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
try:
@ -196,7 +196,7 @@ async def update_help_command_endpoint(
):
"""Update an existing help command"""
if not valid_token(token):
logger.warning(f'update_help_command - Bad Token: {token}')
logger.warning('update_help_command - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
try:
@ -246,7 +246,7 @@ async def restore_help_command_endpoint(
):
"""Restore a soft-deleted help command"""
if not valid_token(token):
logger.warning(f'restore_help_command - Bad Token: {token}')
logger.warning('restore_help_command - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
try:
@ -284,7 +284,7 @@ async def delete_help_command_endpoint(
):
"""Soft delete a help command"""
if not valid_token(token):
logger.warning(f'delete_help_command - Bad Token: {token}')
logger.warning('delete_help_command - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
try:
@ -393,7 +393,7 @@ async def increment_view_count(
):
"""Increment view count for a help command"""
if not valid_token(token):
logger.warning(f'increment_view_count - Bad Token: {token}')
logger.warning('increment_view_count - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
try:

View File

@ -68,7 +68,7 @@ async def get_injuries(
@handle_db_errors
async def patch_injury(injury_id: int, is_active: Optional[bool] = None, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'patch_injury - Bad Token: {token}')
logger.warning('patch_injury - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_injury = Injury.get_or_none(Injury.id == injury_id)
@ -92,7 +92,7 @@ async def patch_injury(injury_id: int, is_active: Optional[bool] = None, token:
@handle_db_errors
async def post_injury(new_injury: InjuryModel, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'post_injury - Bad Token: {token}')
logger.warning('post_injury - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_injury = Injury(**new_injury.dict())
@ -110,7 +110,7 @@ async def post_injury(new_injury: InjuryModel, token: str = Depends(oauth2_schem
@handle_db_errors
async def delete_injury(injury_id: int, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'delete_injury - Bad Token: {token}')
logger.warning('delete_injury - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_injury = Injury.get_or_none(Injury.id == injury_id)

View File

@ -53,7 +53,7 @@ async def patch_keeper(
keeper_id: int, season: Optional[int] = None, team_id: Optional[int] = None, player_id: Optional[int] = None,
token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'patch_keeper - Bad Token: {token}')
logger.warning('patch_keeper - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_keeper = Keeper.get_or_none(Keeper.id == keeper_id)
@ -80,7 +80,7 @@ async def patch_keeper(
@handle_db_errors
async def post_keepers(k_list: KeeperList, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'post_keepers - Bad Token: {token}')
logger.warning('post_keepers - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
new_keepers = []
@ -99,7 +99,7 @@ async def post_keepers(k_list: KeeperList, token: str = Depends(oauth2_scheme)):
@handle_db_errors
async def delete_keeper(keeper_id: int, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'delete_keeper - Bad Token: {token}')
logger.warning('delete_keeper - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_keeper = Keeper.get_or_none(Keeper.id == keeper_id)

View File

@ -94,7 +94,7 @@ async def patch_manager(
manager_id: int, name: Optional[str] = None, image: Optional[str] = None, headline: Optional[str] = None,
bio: Optional[str] = None, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'patch_manager - Bad Token: {token}')
logger.warning('patch_manager - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_manager = Manager.get_or_none(Manager.id == manager_id)
@ -124,7 +124,7 @@ async def patch_manager(
@handle_db_errors
async def post_manager(new_manager: ManagerModel, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'post_manager - Bad Token: {token}')
logger.warning('post_manager - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_manager = Manager(**new_manager.dict())
@ -142,7 +142,7 @@ async def post_manager(new_manager: ManagerModel, token: str = Depends(oauth2_sc
@handle_db_errors
async def delete_manager(manager_id: int, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'delete_manager - Bad Token: {token}')
logger.warning('delete_manager - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_manager = Manager.get_or_none(Manager.id == manager_id)

View File

@ -256,7 +256,7 @@ async def get_totalstats(
@handle_db_errors
async def patch_pitstats(stat_id: int, new_stats: PitStatModel, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'patch_pitstats - Bad Token: {token}')
logger.warning('patch_pitstats - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
if PitchingStat.get_or_none(PitchingStat.id == stat_id) is None:
@ -272,7 +272,7 @@ async def patch_pitstats(stat_id: int, new_stats: PitStatModel, token: str = Dep
@handle_db_errors
async def post_pitstats(s_list: PitStatList, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'post_pitstats - Bad Token: {token}')
logger.warning('post_pitstats - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
all_stats = []

View File

@ -95,7 +95,7 @@ async def patch_result(
home_score: Optional[int] = None, season: Optional[int] = None, scorecard_url: Optional[str] = None,
token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'patch_player - Bad Token: {token}')
logger.warning('patch_player - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_result = Result.get_or_none(Result.id == result_id)
@ -139,7 +139,7 @@ async def patch_result(
@handle_db_errors
async def post_results(result_list: ResultList, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'patch_player - Bad Token: {token}')
logger.warning('patch_player - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
new_results = []
@ -163,7 +163,7 @@ async def post_results(result_list: ResultList, token: str = Depends(oauth2_sche
@handle_db_errors
async def delete_result(result_id: int, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'delete_result - Bad Token: {token}')
logger.warning('delete_result - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_result = Result.get_or_none(Result.id == result_id)

View File

@ -119,7 +119,7 @@ async def patch_player(
key_fangraphs: Optional[str] = None, key_bbref: Optional[str] = None, key_retro: Optional[str] = None,
key_mlbam: Optional[str] = None, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logging.warning(f'Bad Token: {token}')
logging.warning('Bad Token')
db.close()
raise HTTPException(
status_code=401,
@ -160,7 +160,7 @@ async def patch_player(
@handle_db_errors
async def post_players(players: PlayerList, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logging.warning(f'Bad Token: {token}')
logging.warning('Bad Token')
db.close()
raise HTTPException(
status_code=401,
@ -195,7 +195,7 @@ async def post_players(players: PlayerList, token: str = Depends(oauth2_scheme))
@handle_db_errors
async def post_one_player(player: SbaPlayerModel, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logging.warning(f'Bad Token: {token}')
logging.warning('Bad Token')
db.close()
raise HTTPException(
status_code=401,
@ -234,7 +234,7 @@ async def post_one_player(player: SbaPlayerModel, token: str = Depends(oauth2_sc
@handle_db_errors
async def delete_player(player_id: int, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logging.warning(f'Bad Token: {token}')
logging.warning('Bad Token')
db.close()
raise HTTPException(
status_code=401,

View File

@ -89,7 +89,7 @@ async def patch_schedule(
hometeam_id: Optional[int] = None, gamecount: Optional[int] = None, season: Optional[int] = None,
token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'patch_schedule - Bad Token: {token}')
logger.warning('patch_schedule - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_sched = Schedule.get_or_none(Schedule.id == schedule_id)
@ -124,7 +124,7 @@ async def patch_schedule(
@handle_db_errors
async def post_schedules(sched_list: ScheduleList, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'post_schedules - Bad Token: {token}')
logger.warning('post_schedules - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
new_sched = []
@ -148,7 +148,7 @@ async def post_schedules(sched_list: ScheduleList, token: str = Depends(oauth2_s
@handle_db_errors
async def delete_schedule(schedule_id: int, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'delete_schedule - Bad Token: {token}')
logger.warning('delete_schedule - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
this_sched = Schedule.get_or_none(Schedule.id == schedule_id)

View File

@ -71,7 +71,7 @@ async def get_team_standings(team_id: int):
async def patch_standings(
stan_id, wins: Optional[int] = None, losses: Optional[int] = None, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'patch_standings - Bad Token: {token}')
logger.warning('patch_standings - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
try:
@ -95,7 +95,7 @@ async def patch_standings(
@handle_db_errors
async def post_standings(season: int, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'post_standings - Bad Token: {token}')
logger.warning('post_standings - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
new_teams = []
@ -115,7 +115,7 @@ async def post_standings(season: int, token: str = Depends(oauth2_scheme)):
@handle_db_errors
async def recalculate_standings(season: int, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'recalculate_standings - Bad Token: {token}')
logger.warning('recalculate_standings - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
code = Standings.recalculate(season)

View File

@ -153,7 +153,7 @@ async def patch_game(
scorecard_url: Optional[str] = None,
) -> Any:
if not valid_token(token):
logger.warning(f"patch_game - Bad Token: {token}")
logger.warning("patch_game - Bad Token")
raise HTTPException(status_code=401, detail="Unauthorized")
this_game = StratGame.get_or_none(StratGame.id == game_id)
@ -234,7 +234,7 @@ async def patch_game(
@handle_db_errors
async def post_games(game_list: GameList, token: str = Depends(oauth2_scheme)) -> Any:
if not valid_token(token):
logger.warning(f"post_games - Bad Token: {token}")
logger.warning("post_games - Bad Token")
raise HTTPException(status_code=401, detail="Unauthorized")
new_games = []
@ -262,7 +262,7 @@ async def post_games(game_list: GameList, token: str = Depends(oauth2_scheme)) -
@handle_db_errors
async def wipe_game(game_id: int, token: str = Depends(oauth2_scheme)) -> Any:
if not valid_token(token):
logger.warning(f"wipe_game - Bad Token: {token}")
logger.warning("wipe_game - Bad Token")
raise HTTPException(status_code=401, detail="Unauthorized")
this_game = StratGame.get_or_none(StratGame.id == game_id)
@ -289,7 +289,7 @@ async def wipe_game(game_id: int, token: str = Depends(oauth2_scheme)) -> Any:
@handle_db_errors
async def delete_game(game_id: int, token: str = Depends(oauth2_scheme)) -> Any:
if not valid_token(token):
logger.warning(f"delete_game - Bad Token: {token}")
logger.warning("delete_game - Bad Token")
raise HTTPException(status_code=401, detail="Unauthorized")
this_game = StratGame.get_or_none(StratGame.id == game_id)

View File

@ -33,7 +33,7 @@ async def patch_play(
play_id: int, new_play: PlayModel, token: str = Depends(oauth2_scheme)
):
if not valid_token(token):
logger.warning(f"patch_play - Bad Token: {token}")
logger.warning("patch_play - Bad Token")
raise HTTPException(status_code=401, detail="Unauthorized")
if StratPlay.get_or_none(StratPlay.id == play_id) is None:
@ -50,7 +50,7 @@ async def patch_play(
@handle_db_errors
async def post_plays(p_list: PlayList, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f"post_plays - Bad Token: {token}")
logger.warning("post_plays - Bad Token")
raise HTTPException(status_code=401, detail="Unauthorized")
new_plays = []
@ -102,7 +102,7 @@ async def post_plays(p_list: PlayList, token: str = Depends(oauth2_scheme)):
@handle_db_errors
async def delete_play(play_id: int, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f"delete_play - Bad Token: {token}")
logger.warning("delete_play - Bad Token")
raise HTTPException(status_code=401, detail="Unauthorized")
this_play = StratPlay.get_or_none(StratPlay.id == play_id)
@ -125,7 +125,7 @@ async def delete_play(play_id: int, token: str = Depends(oauth2_scheme)):
@handle_db_errors
async def delete_plays_game(game_id: int, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f"delete_plays_game - Bad Token: {token}")
logger.warning("delete_plays_game - Bad Token")
raise HTTPException(status_code=401, detail="Unauthorized")
this_game = StratGame.get_or_none(StratGame.id == game_id)
@ -148,7 +148,7 @@ async def delete_plays_game(game_id: int, token: str = Depends(oauth2_scheme)):
@handle_db_errors
async def post_erun_check(token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f"post_erun_check - Bad Token: {token}")
logger.warning("post_erun_check - Bad Token")
raise HTTPException(status_code=401, detail="Unauthorized")
all_plays = StratPlay.update(run=1).where(

View File

@ -93,7 +93,7 @@ async def get_transactions(
async def patch_transactions(
move_id, token: str = Depends(oauth2_scheme), frozen: Optional[bool] = None, cancelled: Optional[bool] = None):
if not valid_token(token):
logger.warning(f'patch_transactions - Bad Token: {token}')
logger.warning('patch_transactions - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
these_moves = Transaction.select().where(Transaction.moveid == move_id)
@ -118,7 +118,7 @@ async def patch_transactions(
@handle_db_errors
async def post_transactions(moves: TransactionList, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'post_transactions - Bad Token: {token}')
logger.warning('post_transactions - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
all_moves = []
@ -145,7 +145,7 @@ async def post_transactions(moves: TransactionList, token: str = Depends(oauth2_
@handle_db_errors
async def delete_transactions(move_id, token: str = Depends(oauth2_scheme)):
if not valid_token(token):
logger.warning(f'delete_transactions - Bad Token: {token}')
logger.warning('delete_transactions - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
delete_query = Transaction.delete().where(Transaction.moveid == move_id)

View File

@ -78,7 +78,7 @@ async def refresh_season_batting_stats(
Useful for full season updates.
"""
if not valid_token(token):
logger.warning(f'refresh_season_batting_stats - Bad Token: {token}')
logger.warning('refresh_season_batting_stats - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
logger.info(f'Refreshing all batting stats for season {season}')
@ -174,7 +174,7 @@ async def refresh_season_pitching_stats(
Private endpoint - not included in public API documentation.
"""
if not valid_token(token):
logger.warning(f'refresh_season_batting_stats - Bad Token: {token}')
logger.warning('refresh_season_batting_stats - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
logger.info(f'Refreshing season {season} pitching stats')
@ -223,7 +223,7 @@ async def get_admin_cache_stats(
Private endpoint - requires authentication.
"""
if not valid_token(token):
logger.warning(f'get_admin_cache_stats - Bad Token: {token}')
logger.warning('get_admin_cache_stats - Bad Token')
raise HTTPException(status_code=401, detail='Unauthorized')
logger.info('Getting cache statistics')