|
29 | 29 | from typing import Literal, Optional |
30 | 30 |
|
31 | 31 | import redis.asyncio as redis |
32 | | -from fastapi import APIRouter, HTTPException, Request |
| 32 | +from fastapi import APIRouter, HTTPException, Request, status |
33 | 33 | from pydantic import BaseModel, Field, field_validator |
34 | 34 |
|
35 | 35 | # Note: `from __future__ import annotations` is intentionally NOT used here. |
@@ -212,7 +212,7 @@ def _signing_key(sub_sid: str) -> str: |
212 | 212 | async def _validate_session(sid: str) -> dict: |
213 | 213 | raw = await _redis().get(_session_key(sid)) |
214 | 214 | if raw is None: |
215 | | - raise HTTPException(status_code=404, detail="Pairing session not found or expired") |
| 215 | + raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Pairing session not found or expired") |
216 | 216 | return json.loads(raw) |
217 | 217 |
|
218 | 218 |
|
@@ -264,7 +264,7 @@ async def poll_session(session_id: str, request: Request): |
264 | 264 | if raw is None: |
265 | 265 | raw = await _redis().get(_signing_key(session_id)) |
266 | 266 | if raw is None: |
267 | | - raise HTTPException(status_code=404, detail="Session not found or expired") |
| 267 | + raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Session not found or expired") |
268 | 268 | data = json.loads(raw) |
269 | 269 | return PollResponse( |
270 | 270 | session_id=session_id, |
@@ -325,7 +325,7 @@ async def submit_signed_envelope( |
325 | 325 | # Wallet hit the pairing endpoint instead of the signing one. |
326 | 326 | raw = await _redis().get(_session_key(session_id)) |
327 | 327 | if raw is None: |
328 | | - raise HTTPException(status_code=404, detail="Unknown session") |
| 328 | + raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Unknown session") |
329 | 329 | data = json.loads(raw) |
330 | 330 | if payload.public_key: |
331 | 331 | data["public_key"] = payload.public_key |
|
0 commit comments