Lots of changes to get to FastAPI 95.1

This commit is contained in:
Scott Idem
2024-04-26 15:15:37 -04:00
parent f4eda34035
commit faecd974b9
38 changed files with 78 additions and 79 deletions

View File

@@ -1,5 +1,5 @@
import aiofiles, datetime, hashlib, mimetypes, os, pathlib, random, shutil, subprocess, shlex, tempfile, time
from fastapi import APIRouter, Body, Depends, File, Form, Header, HTTPException, Query, Response, status, UploadFile
from fastapi import APIRouter, Body, Depends, File, Form, Header, HTTPException, Path, Query, Response, status, UploadFile
from fastapi.responses import FileResponse, StreamingResponse
# from fastapi.responses import StreamingResponse
# from baize.asgi.responses import FileResponse
@@ -909,7 +909,7 @@ async def get_hosted_file_obj(
# Updated 2021-09-07
@router.get('/hash/{hosted_file_hash}', response_model=Resp_Body_Base)
async def check_hosted_file_obj_w_hash(
hosted_file_hash: str = Query(..., min_length=64, max_length=64), # Expects SHA256 hash
hosted_file_hash: str = Path(min_length=64, max_length=64), # Expects SHA256 hash
check_for_local: Optional[bool] = True,
commons: Common_Route_Params = Depends(common_route_params),
@@ -955,8 +955,8 @@ async def check_hosted_file_obj_w_hash(
# Updated 2023-04-05
@router.get('/tmp/{subdirectory}/{filename}/download', response_model=Resp_Body_Base)
async def download_tmp(
subdirectory: str = Query(..., min_length=1, max_length=100),
filename: str = Query(..., min_length=4, max_length=120),
subdirectory: str = Path(min_length=1, max_length=100),
filename: str = Path(min_length=4, max_length=120),
commons: Common_Route_Params = Depends(common_route_params),
):