fix: remove plaintext bearer token from warning logs (#7)
Replace all logging.warning(f'Bad Token: {token}') calls with
logging.warning('Bad Token: [REDACTED]') across 30 router files.
Full bearer tokens were being written to log files on auth failures.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8283425b84
commit
35389cac24
@ -14,7 +14,7 @@ router = APIRouter(
|
||||
@router.post('/stl-fix', include_in_schema=PRIVATE_IN_SCHEMA)
|
||||
async def stl_cardinals_fix(token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to post. This event has been logged.'
|
||||
|
||||
@ -94,7 +94,7 @@ async def get_one_award(award_id, csv: Optional[bool] = None):
|
||||
@router.post('', include_in_schema=PRIVATE_IN_SCHEMA)
|
||||
async def post_awards(award: AwardModel, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to post awards. This event has been logged.'
|
||||
@ -123,7 +123,7 @@ async def post_awards(award: AwardModel, token: str = Depends(oauth2_scheme)):
|
||||
@router.delete('/{award_id}', include_in_schema=PRIVATE_IN_SCHEMA)
|
||||
async def delete_award(award_id, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to delete awards. This event has been logged.'
|
||||
|
||||
@ -173,7 +173,7 @@ async def get_player_stats(
|
||||
@router.post('', include_in_schema=PRIVATE_IN_SCHEMA)
|
||||
async def post_batstats(stats: BattingStatModel, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to post stats. This event has been logged.'
|
||||
@ -229,7 +229,7 @@ async def post_batstats(stats: BattingStatModel, token: str = Depends(oauth2_sch
|
||||
@router.delete('/{stat_id}', include_in_schema=PRIVATE_IN_SCHEMA)
|
||||
async def delete_batstat(stat_id, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to delete stats. This event has been logged.'
|
||||
|
||||
@ -154,7 +154,7 @@ async def get_card_ratings(
|
||||
status_code=401, detail="You are not authorized to pull card ratings."
|
||||
)
|
||||
# elif not valid_token(token):
|
||||
# logging.warning(f'Bad Token: {token}')
|
||||
# logging.warning('Bad Token: [REDACTED]')
|
||||
# db.close()
|
||||
# raise HTTPException(
|
||||
# status_code=401,
|
||||
@ -349,7 +349,7 @@ async def get_card_scouting(team_id: int, ts: str):
|
||||
@router.post("/calculate/scouting", include_in_schema=PRIVATE_IN_SCHEMA)
|
||||
async def post_calc_scouting(token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401, detail="You are not authorized to calculate card ratings."
|
||||
)
|
||||
@ -385,7 +385,7 @@ async def get_basic_scouting(cardset_id: list = Query(default=None)):
|
||||
@router.post("/calculate/basic", include_in_schema=PRIVATE_IN_SCHEMA)
|
||||
async def post_calc_basic(token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401, detail="You are not authorized to calculate basic ratings."
|
||||
)
|
||||
@ -631,7 +631,7 @@ async def post_calc_basic(token: str = Depends(oauth2_scheme)):
|
||||
@router.get("/{ratings_id}")
|
||||
async def get_one_rating(ratings_id: int, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401, detail="You are not authorized to pull card ratings."
|
||||
)
|
||||
@ -654,7 +654,7 @@ async def get_player_ratings(
|
||||
token: str = Depends(oauth2_scheme),
|
||||
):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401, detail="You are not authorized to pull card ratings."
|
||||
)
|
||||
@ -681,7 +681,7 @@ async def get_player_ratings(
|
||||
@router.put("", include_in_schema=PRIVATE_IN_SCHEMA)
|
||||
async def put_ratings(ratings: RatingsList, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401, detail="You are not authorized to post card ratings."
|
||||
)
|
||||
@ -715,7 +715,7 @@ async def put_ratings(ratings: RatingsList, token: str = Depends(oauth2_scheme))
|
||||
@router.delete("/{ratings_id}", include_in_schema=PRIVATE_IN_SCHEMA)
|
||||
async def delete_rating(ratings_id: int, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401, detail="You are not authorized to post card ratings."
|
||||
)
|
||||
|
||||
@ -97,7 +97,7 @@ async def get_player_cards(
|
||||
@router.put("")
|
||||
async def put_cards(cards: BattingCardList, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to post batting cards. This event has been logged.",
|
||||
@ -165,7 +165,7 @@ async def patch_card(
|
||||
token: str = Depends(oauth2_scheme),
|
||||
):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to patch batting cards. This event has been logged.",
|
||||
@ -209,7 +209,7 @@ async def patch_card(
|
||||
@router.delete("/{card_id}")
|
||||
async def delete_card(card_id: int, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to delete batting cards. This event has been logged.",
|
||||
@ -234,7 +234,7 @@ async def delete_card(card_id: int, token: str = Depends(oauth2_scheme)):
|
||||
@router.delete("")
|
||||
async def delete_all_cards(token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to delete batting cards. This event has been logged.",
|
||||
|
||||
@ -108,7 +108,7 @@ async def get_one_position(position_id: int):
|
||||
@router.put("")
|
||||
async def put_positions(positions: PositionList, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to post card positions. This event has been logged.",
|
||||
@ -146,7 +146,7 @@ async def put_positions(positions: PositionList, token: str = Depends(oauth2_sch
|
||||
@router.delete("/{position_id}")
|
||||
async def delete_position(position_id: int, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to delete card positions. This event has been logged.",
|
||||
|
||||
@ -145,7 +145,7 @@ async def v1_cards_get_one(card_id, csv: Optional[bool] = False):
|
||||
@router.post('')
|
||||
async def v1_cards_post(cards: CardModel, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to post cards. This event has been logged.'
|
||||
@ -187,7 +187,7 @@ async def v1_cards_post(cards: CardModel, token: str = Depends(oauth2_scheme)):
|
||||
# @router.post('/ai-update')
|
||||
# async def v1_cards_ai_update(token: str = Depends(oauth2_scheme)):
|
||||
# if not valid_token(token):
|
||||
# logging.warning(f'Bad Token: {token}')
|
||||
# logging.warning('Bad Token: [REDACTED]')
|
||||
# db.close()
|
||||
# raise HTTPException(
|
||||
# status_code=401,
|
||||
@ -202,7 +202,7 @@ async def v1_cards_post(cards: CardModel, token: str = Depends(oauth2_scheme)):
|
||||
async def v1_cards_legal_check(
|
||||
rarity_name: str, card_id: list = Query(default=None), token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='Unauthorized'
|
||||
@ -234,7 +234,7 @@ async def v1_cards_legal_check(
|
||||
@router.post('/post-update/{starting_id}')
|
||||
async def v1_cards_post_update(starting_id: int, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to update card lists. This event has been logged.'
|
||||
@ -247,7 +247,7 @@ async def v1_cards_post_update(starting_id: int, token: str = Depends(oauth2_sch
|
||||
@router.post('/post-delete')
|
||||
async def v1_cards_post_delete(del_ids: str, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to delete card lists. This event has been logged.'
|
||||
@ -260,7 +260,7 @@ async def v1_cards_post_delete(del_ids: str, token: str = Depends(oauth2_scheme)
|
||||
@router.post('/wipe-team/{team_id}')
|
||||
async def v1_cards_wipe_team(team_id: int, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to wipe teams. This event has been logged.'
|
||||
@ -282,7 +282,7 @@ async def v1_cards_patch(
|
||||
value: Optional[int] = None, variant: Optional[int] = None, roster1_id: Optional[int] = None, roster2_id: Optional[int] = None,
|
||||
roster3_id: Optional[int] = None, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to patch cards. This event has been logged.'
|
||||
@ -325,7 +325,7 @@ async def v1_cards_patch(
|
||||
@router.delete('/{card_id}')
|
||||
async def v1_cards_delete(card_id, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to delete packs. This event has been logged.'
|
||||
|
||||
@ -169,7 +169,7 @@ async def get_one_cardset(cardset_id, csv: Optional[bool] = False):
|
||||
@router.post('')
|
||||
async def post_cardsets(cardset: CardsetModel, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to post cardsets. This event has been logged.'
|
||||
@ -198,7 +198,7 @@ async def patch_cardsets(
|
||||
for_purchase: Optional[bool] = None, total_cards: Optional[int] = None, ranked_legal: Optional[bool] = None,
|
||||
token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to patch cardsets. This event has been logged.'
|
||||
@ -234,7 +234,7 @@ async def patch_cardsets(
|
||||
@router.delete('/{cardset_id}')
|
||||
async def delete_cardsets(cardset_id, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to delete cardsets. This event has been logged.'
|
||||
|
||||
@ -64,7 +64,7 @@ async def get_one_current(current_id, csv: Optional[bool] = False):
|
||||
@router.post('', include_in_schema=PRIVATE_IN_SCHEMA)
|
||||
async def post_current(current: CurrentModel, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to post current. This event has been logged.'
|
||||
@ -95,7 +95,7 @@ async def patch_current(
|
||||
gsheet_template: Optional[str] = None, gsheet_version: Optional[str] = None,
|
||||
live_scoreboard: Optional[int] = None, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to patch current. This event has been logged.'
|
||||
@ -129,7 +129,7 @@ async def patch_current(
|
||||
@router.delete('/{current_id}', include_in_schema=PRIVATE_IN_SCHEMA)
|
||||
async def delete_current(current_id, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to delete current. This event has been logged.'
|
||||
|
||||
@ -201,7 +201,7 @@ async def patch_decision(
|
||||
token: str = Depends(oauth2_scheme),
|
||||
):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"patch_decision - Bad Token: {token}")
|
||||
logging.warning("patch_decision - Bad Token: [REDACTED]")
|
||||
raise HTTPException(status_code=401, detail="Unauthorized")
|
||||
|
||||
this_dec = Decision.get_or_none(Decision.id == decision_id)
|
||||
@ -241,7 +241,7 @@ async def patch_decision(
|
||||
@router.post("")
|
||||
async def post_decisions(dec_list: DecisionList, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"post_decisions - Bad Token: {token}")
|
||||
logging.warning("post_decisions - Bad Token: [REDACTED]")
|
||||
raise HTTPException(status_code=401, detail="Unauthorized")
|
||||
|
||||
new_dec = []
|
||||
@ -271,7 +271,7 @@ async def post_decisions(dec_list: DecisionList, token: str = Depends(oauth2_sch
|
||||
@router.delete("/{decision_id}")
|
||||
async def delete_decision(decision_id: int, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"delete_decision - Bad Token: {token}")
|
||||
logging.warning("delete_decision - Bad Token: [REDACTED]")
|
||||
raise HTTPException(status_code=401, detail="Unauthorized")
|
||||
|
||||
this_dec = Decision.get_or_none(Decision.id == decision_id)
|
||||
@ -293,7 +293,7 @@ async def delete_decision(decision_id: int, token: str = Depends(oauth2_scheme))
|
||||
@router.delete("/game/{game_id}")
|
||||
async def delete_decisions_game(game_id: int, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"delete_decisions_game - Bad Token: {token}")
|
||||
logging.warning("delete_decisions_game - Bad Token: [REDACTED]")
|
||||
raise HTTPException(status_code=401, detail="Unauthorized")
|
||||
|
||||
this_game = StratGame.get_or_none(StratGame.id == game_id)
|
||||
|
||||
@ -84,7 +84,7 @@ async def v1_events_get_one(event_id, csv: Optional[bool] = False):
|
||||
@router.post('')
|
||||
async def v1_events_post(event: EventModel, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to post events. This event has been logged.'
|
||||
@ -120,7 +120,7 @@ async def v1_events_patch(
|
||||
url: Optional[str] = None, thumbnail: Optional[str] = None, active: Optional[bool] = None,
|
||||
token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to patch events. This event has been logged.'
|
||||
@ -156,7 +156,7 @@ async def v1_events_patch(
|
||||
@router.delete('/{event_id}')
|
||||
async def v1_events_delete(event_id, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to delete events. This event has been logged.'
|
||||
|
||||
@ -84,7 +84,7 @@ async def v1_gamerewards_get_one(gamereward_id, csv: Optional[bool] = None):
|
||||
@router.post('')
|
||||
async def v1_gamerewards_post(game_reward: GameRewardModel, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to post game rewards. This event has been logged.'
|
||||
@ -113,7 +113,7 @@ async def v1_gamerewards_patch(
|
||||
game_reward_id: int, name: Optional[str] = None, pack_type_id: Optional[int] = None,
|
||||
player_id: Optional[int] = None, money: Optional[int] = None, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to patch gamerewards. This event has been logged.'
|
||||
@ -154,7 +154,7 @@ async def v1_gamerewards_patch(
|
||||
@router.delete('/{gamereward_id}')
|
||||
async def v1_gamerewards_delete(gamereward_id, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to delete awards. This event has been logged.'
|
||||
|
||||
@ -78,7 +78,7 @@ async def v1_gauntletreward_patch(
|
||||
token: str = Depends(oauth2_scheme),
|
||||
):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to patch gauntlet rewards. This event has been logged.",
|
||||
@ -111,7 +111,7 @@ async def v1_gauntletreward_post(
|
||||
gauntletreward: GauntletRewardList, token: str = Depends(oauth2_scheme)
|
||||
):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to post gauntlets. This event has been logged.",
|
||||
|
||||
@ -97,7 +97,7 @@ async def patch_gauntletrun(
|
||||
gsheet: Optional[str] = None, created: Optional[bool] = None, ended: Optional[bool] = None,
|
||||
token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to patch gauntlet runs. This event has been logged.'
|
||||
@ -136,7 +136,7 @@ async def patch_gauntletrun(
|
||||
@router.post('')
|
||||
async def post_gauntletrun(gauntletrun: GauntletRunModel, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to post gauntlets. This event has been logged.'
|
||||
|
||||
@ -137,7 +137,7 @@ async def patch_player(
|
||||
token: str = Depends(oauth2_scheme),
|
||||
):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to patch mlb players. This event has been logged.",
|
||||
@ -177,7 +177,7 @@ async def patch_player(
|
||||
@router.post("")
|
||||
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: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to post mlb players. This event has been logged.",
|
||||
@ -210,7 +210,7 @@ async def post_players(players: PlayerList, token: str = Depends(oauth2_scheme))
|
||||
@router.post("/one")
|
||||
async def post_one_player(player: PlayerModel, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to post mlb players. This event has been logged.",
|
||||
@ -245,7 +245,7 @@ async def post_one_player(player: PlayerModel, token: str = Depends(oauth2_schem
|
||||
@router.delete("/{player_id}")
|
||||
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: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to delete mlb players. This event has been logged.",
|
||||
@ -275,7 +275,7 @@ async def update_columns(
|
||||
mlbplayer_id: Optional[int] = None, token: str = Depends(oauth2_scheme)
|
||||
):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to update mlb players. This event has been logged.",
|
||||
@ -310,7 +310,7 @@ async def update_names(
|
||||
mlbplayer_id: Optional[int] = None, token: str = Depends(oauth2_scheme)
|
||||
):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to update mlb players. This event has been logged.",
|
||||
@ -338,7 +338,7 @@ async def update_names(
|
||||
# @router.post('/link-players')
|
||||
# async def post_players(token: str = Depends(oauth2_scheme)):
|
||||
# if not valid_token(token):
|
||||
# logging.warning(f'Bad Token: {token}')
|
||||
# logging.warning('Bad Token: [REDACTED]')
|
||||
# db.close()
|
||||
# raise HTTPException(
|
||||
# status_code=401,
|
||||
|
||||
@ -95,7 +95,7 @@ async def get_one_notif(notif_id, csv: Optional[bool] = None):
|
||||
@router.post('')
|
||||
async def post_notif(notif: NotifModel, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to post notifications. This event has been logged.'
|
||||
@ -128,7 +128,7 @@ async def patch_notif(
|
||||
field_name: Optional[str] = None, message: Optional[str] = None, about: Optional[str] = None,
|
||||
ack: Optional[bool] = None, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to patch notifications. This event has been logged.'
|
||||
@ -166,7 +166,7 @@ async def patch_notif(
|
||||
@router.delete('/{notif_id}')
|
||||
async def delete_notif(notif_id, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to delete notifications. This event has been logged.'
|
||||
|
||||
@ -128,7 +128,7 @@ async def get_one_pack(pack_id: int, csv: Optional[bool] = False):
|
||||
@router.post('')
|
||||
async def post_pack(packs: PackModel, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to post packs. This event has been logged.'
|
||||
@ -154,7 +154,7 @@ async def post_pack(packs: PackModel, token: str = Depends(oauth2_scheme)):
|
||||
@router.post('/one')
|
||||
async def post_one_pack(pack: PackPydantic, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to post packs. This event has been logged.'
|
||||
@ -184,7 +184,7 @@ async def patch_pack(
|
||||
pack_id, team_id: Optional[int] = None, pack_type_id: Optional[int] = None, open_time: Optional[int] = None,
|
||||
pack_team_id: Optional[int] = None, pack_cardset_id: Optional[int] = None, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to patch packs. This event has been logged.'
|
||||
@ -227,7 +227,7 @@ async def patch_pack(
|
||||
@router.delete('/{pack_id}')
|
||||
async def delete_pack(pack_id, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to delete packs. This event has been logged.'
|
||||
|
||||
@ -88,7 +88,7 @@ async def get_one_packtype(packtype_id, csv: Optional[bool] = False):
|
||||
@router.post('')
|
||||
async def post_packtypes(packtype: PacktypeModel, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to post packtypes. This event has been logged.'
|
||||
@ -122,7 +122,7 @@ async def patch_packtype(
|
||||
packtype_id, name: Optional[str] = None, card_count: Optional[int] = None, description: Optional[str] = None,
|
||||
cost: Optional[int] = None, available: Optional[bool] = None, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to patch packtypes. This event has been logged.'
|
||||
@ -156,7 +156,7 @@ async def patch_packtype(
|
||||
@router.delete('/{packtype_id}')
|
||||
async def delete_packtype(packtype_id, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to delete packtypes. This event has been logged.'
|
||||
|
||||
@ -95,7 +95,7 @@ async def get_one_paperdex(paperdex_id, csv: Optional[bool] = False):
|
||||
@router.post('')
|
||||
async def post_paperdex(paperdex: PaperdexModel, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to post paperdex. This event has been logged.'
|
||||
@ -128,7 +128,7 @@ async def patch_paperdex(
|
||||
paperdex_id, team_id: Optional[int] = None, player_id: Optional[int] = None, created: Optional[int] = None,
|
||||
token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to patch paperdex. This event has been logged.'
|
||||
@ -158,7 +158,7 @@ async def patch_paperdex(
|
||||
@router.delete('/{paperdex_id}')
|
||||
async def delete_paperdex(paperdex_id, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to delete rewards. This event has been logged.'
|
||||
@ -179,7 +179,7 @@ async def delete_paperdex(paperdex_id, token: str = Depends(oauth2_scheme)):
|
||||
@router.post('/wipe-ai')
|
||||
async def wipe_ai_paperdex(token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='Unauthorized'
|
||||
|
||||
@ -146,7 +146,7 @@ async def get_card_ratings(
|
||||
token: str = Depends(oauth2_scheme),
|
||||
):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401, detail="You are not authorized to pull card ratings."
|
||||
)
|
||||
@ -269,7 +269,7 @@ async def get_card_scouting(team_id: int, ts: str):
|
||||
@router.post("/calculate/scouting")
|
||||
async def post_calc_scouting(token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401, detail="You are not authorized to calculate card ratings."
|
||||
)
|
||||
@ -305,7 +305,7 @@ async def get_basic_scouting():
|
||||
@router.post("/calculate/basic")
|
||||
async def post_calc_basic(token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401, detail="You are not authorized to calculate basic ratings."
|
||||
)
|
||||
@ -484,7 +484,7 @@ async def post_calc_basic(token: str = Depends(oauth2_scheme)):
|
||||
@router.get("/{ratings_id}")
|
||||
async def get_one_rating(ratings_id: int, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401, detail="You are not authorized to pull card ratings."
|
||||
)
|
||||
@ -525,7 +525,7 @@ async def get_player_ratings(
|
||||
@router.put("")
|
||||
async def put_ratings(ratings: RatingsList, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401, detail="You are not authorized to post card ratings."
|
||||
)
|
||||
@ -559,7 +559,7 @@ async def put_ratings(ratings: RatingsList, token: str = Depends(oauth2_scheme))
|
||||
@router.delete("/{ratings_id}")
|
||||
async def delete_rating(ratings_id: int, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401, detail="You are not authorized to post card ratings."
|
||||
)
|
||||
|
||||
@ -94,7 +94,7 @@ async def get_player_cards(
|
||||
@router.put("")
|
||||
async def put_cards(cards: PitchingCardList, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to post pitching cards. This event has been logged.",
|
||||
@ -159,7 +159,7 @@ async def patch_card(
|
||||
token: str = Depends(oauth2_scheme),
|
||||
):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to patch pitching cards. This event has been logged.",
|
||||
@ -199,7 +199,7 @@ async def patch_card(
|
||||
@router.delete("/{card_id}")
|
||||
async def delete_card(card_id: int, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to delete pitching cards. This event has been logged.",
|
||||
@ -222,7 +222,7 @@ async def delete_card(card_id: int, token: str = Depends(oauth2_scheme)):
|
||||
@router.delete("")
|
||||
async def delete_all_cards(token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to delete pitching cards. This event has been logged.",
|
||||
|
||||
@ -116,7 +116,7 @@ async def get_pit_stats(
|
||||
@router.post('')
|
||||
async def post_pitstat(stats: PitchingStatModel, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to post stats. This event has been logged.'
|
||||
@ -163,7 +163,7 @@ async def post_pitstat(stats: PitchingStatModel, token: str = Depends(oauth2_sch
|
||||
@router.delete('/{stat_id}')
|
||||
async def delete_pitstat(stat_id, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to delete stats. This event has been logged.'
|
||||
|
||||
@ -860,7 +860,7 @@ async def v1_players_patch(
|
||||
token: str = Depends(oauth2_scheme),
|
||||
):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to patch players. This event has been logged.",
|
||||
@ -972,7 +972,7 @@ async def v1_players_patch(
|
||||
@router.put("")
|
||||
async def put_players(players: PlayerModel, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to post players. This event has been logged.",
|
||||
@ -1051,7 +1051,7 @@ async def put_players(players: PlayerModel, token: str = Depends(oauth2_scheme))
|
||||
@router.post("")
|
||||
async def post_players(new_player: PlayerPydantic, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to post players. This event has been logged.",
|
||||
@ -1082,7 +1082,7 @@ async def post_image_reset(
|
||||
player_id: int, dev: bool = False, token: str = Depends(oauth2_scheme)
|
||||
):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to modify players. This event has been logged.",
|
||||
@ -1116,7 +1116,7 @@ async def post_image_reset(
|
||||
@router.delete("/{player_id}")
|
||||
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: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to delete players. This event has been logged.",
|
||||
|
||||
@ -86,7 +86,7 @@ async def get_one_rarity(rarity_id, csv: Optional[bool] = False):
|
||||
@router.post('')
|
||||
async def post_rarity(rarity: RarityModel, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to post rarities. This event has been logged.'
|
||||
@ -118,7 +118,7 @@ async def patch_rarity(
|
||||
rarity_id, value: Optional[int] = None, name: Optional[str] = None, color: Optional[str] = None,
|
||||
token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to patch rarities. This event has been logged.'
|
||||
@ -148,7 +148,7 @@ async def patch_rarity(
|
||||
@router.delete('/{rarity_id}')
|
||||
async def v1_rarities_delete(rarity_id, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to delete rarities. This event has been logged.'
|
||||
|
||||
@ -245,7 +245,7 @@ async def get_team_results(
|
||||
@router.post('')
|
||||
async def post_result(result: ResultModel, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to post results. This event has been logged.'
|
||||
@ -325,7 +325,7 @@ async def patch_result(
|
||||
season: Optional[int] = None, short_game: Optional[bool] = None, game_type: Optional[str] = None,
|
||||
token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to patch results. This event has been logged.'
|
||||
@ -384,7 +384,7 @@ async def patch_result(
|
||||
@router.delete('/{result_id}')
|
||||
async def delete_result(result_id, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to post results. This event has been logged.'
|
||||
|
||||
@ -95,7 +95,7 @@ async def get_one_reward(reward_id, csv: Optional[bool] = False):
|
||||
@router.post('')
|
||||
async def post_rewards(reward: RewardModel, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to post rewards. This event has been logged.'
|
||||
@ -123,7 +123,7 @@ async def patch_reward(
|
||||
reward_id, name: Optional[str] = None, team_id: Optional[int] = None, created: Optional[int] = None,
|
||||
token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to patch rewards. This event has been logged.'
|
||||
@ -154,7 +154,7 @@ async def patch_reward(
|
||||
@router.delete('/{reward_id}')
|
||||
async def delete_reward(reward_id, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to delete rewards. This event has been logged.'
|
||||
|
||||
@ -47,7 +47,7 @@ async def get_player_keys(player_id: list = Query(default=None)):
|
||||
@router.post('/live-update/batting')
|
||||
def live_update_batting(files: BattingFiles, cardset_id: int, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to initiate live updates.'
|
||||
@ -81,7 +81,7 @@ def live_update_batting(files: BattingFiles, cardset_id: int, token: str = Depen
|
||||
@router.post('/live-update/pitching')
|
||||
def live_update_pitching(files: BattingFiles, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'Bad Token: {token}')
|
||||
logging.warning('Bad Token: [REDACTED]')
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail='You are not authorized to initiate live updates.'
|
||||
|
||||
@ -105,7 +105,7 @@ async def patch_game(
|
||||
game_id: int, game_type: Optional[str] = None, away_score: Optional[int] = None,
|
||||
home_score: Optional[int] = None, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'patch_game - Bad Token: {token}')
|
||||
logging.warning('patch_game - Bad Token: [REDACTED]')
|
||||
raise HTTPException(status_code=401, detail='Unauthorized')
|
||||
|
||||
this_game = StratGame.get_or_none(StratGame.id == game_id)
|
||||
@ -129,7 +129,7 @@ async def patch_game(
|
||||
@router.post('')
|
||||
async def post_game(this_game: GameModel, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'post_games - Bad Token: {token}')
|
||||
logging.warning('post_games - Bad Token: [REDACTED]')
|
||||
raise HTTPException(status_code=401, detail='Unauthorized')
|
||||
|
||||
this_game = StratGame(**this_game.dict())
|
||||
@ -148,7 +148,7 @@ async def post_game(this_game: GameModel, token: str = Depends(oauth2_scheme)):
|
||||
@router.delete('/{game_id}')
|
||||
async def delete_game(game_id: int, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f'delete_game - Bad Token: {token}')
|
||||
logging.warning('delete_game - Bad Token: [REDACTED]')
|
||||
raise HTTPException(status_code=401, detail='Unauthorized')
|
||||
|
||||
this_game = StratGame.get_or_none(StratGame.id == game_id)
|
||||
|
||||
@ -1401,7 +1401,7 @@ async def patch_play(
|
||||
play_id: int, new_play: PlayModel, token: str = Depends(oauth2_scheme)
|
||||
):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"patch_play - Bad Token: {token}")
|
||||
logging.warning("patch_play - Bad Token: [REDACTED]")
|
||||
raise HTTPException(status_code=401, detail="Unauthorized")
|
||||
|
||||
if StratPlay.get_or_none(StratPlay.id == play_id) is None:
|
||||
@ -1415,7 +1415,7 @@ async def patch_play(
|
||||
@router.post("")
|
||||
async def post_plays(p_list: PlayList, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"post_plays - Bad Token: {token}")
|
||||
logging.warning("post_plays - Bad Token: [REDACTED]")
|
||||
raise HTTPException(status_code=401, detail="Unauthorized")
|
||||
|
||||
new_plays = []
|
||||
@ -1465,7 +1465,7 @@ async def post_plays(p_list: PlayList, token: str = Depends(oauth2_scheme)):
|
||||
@router.delete("/{play_id}")
|
||||
async def delete_play(play_id: int, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"delete_play - Bad Token: {token}")
|
||||
logging.warning("delete_play - Bad Token: [REDACTED]")
|
||||
raise HTTPException(status_code=401, detail="Unauthorized")
|
||||
|
||||
this_play = StratPlay.get_or_none(StratPlay.id == play_id)
|
||||
@ -1485,7 +1485,7 @@ async def delete_play(play_id: int, token: str = Depends(oauth2_scheme)):
|
||||
@router.delete("/game/{game_id}")
|
||||
async def delete_plays_game(game_id: int, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"delete_plays_game - Bad Token: {token}")
|
||||
logging.warning("delete_plays_game - Bad Token: [REDACTED]")
|
||||
raise HTTPException(status_code=401, detail="Unauthorized")
|
||||
|
||||
this_game = StratGame.get_or_none(StratGame.id == game_id)
|
||||
|
||||
@ -1317,7 +1317,7 @@ async def get_team_cards(team_id, csv: Optional[bool] = True):
|
||||
@router.post("", include_in_schema=PRIVATE_IN_SCHEMA)
|
||||
async def post_team(team: TeamModel, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to post teams. This event has been logged.",
|
||||
@ -1363,7 +1363,7 @@ async def post_team(team: TeamModel, token: str = Depends(oauth2_scheme)):
|
||||
@router.post("/new-season/{new_season}", include_in_schema=PRIVATE_IN_SCHEMA)
|
||||
async def team_season_update(new_season: int, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to post teams. This event has been logged.",
|
||||
@ -1386,7 +1386,7 @@ async def team_update_money(
|
||||
team_id: int, delta: int, token: str = Depends(oauth2_scheme)
|
||||
):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to adjust wallets. This event has been logged.",
|
||||
@ -1431,7 +1431,7 @@ async def patch_team(
|
||||
abbrev: Optional[str] = None,
|
||||
):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to delete teams. This event has been logged.",
|
||||
@ -1493,7 +1493,7 @@ async def patch_team(
|
||||
@router.delete("/{team_id}", include_in_schema=PRIVATE_IN_SCHEMA)
|
||||
async def delete_team(team_id, token: str = Depends(oauth2_scheme)):
|
||||
if not valid_token(token):
|
||||
logging.warning(f"Bad Token: {token}")
|
||||
logging.warning("Bad Token: [REDACTED]")
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="You are not authorized to delete teams. This event has been logged.",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user