diff --git a/bedhost/routers/api.py b/bedhost/routers/api.py index 21fec2ea..2f7e2276 100644 --- a/bedhost/routers/api.py +++ b/bedhost/routers/api.py @@ -82,6 +82,11 @@ example=ex_chr, ) + +class BEDLIST(BaseModel): + md5sums: list + + # misc endpoints @router.get("/versions", response_model=Dict[str, str]) async def get_version_info(): @@ -783,9 +788,9 @@ async def create_new_bedset( return Response(m.hexdigest(), media_type="text/plain") -@router.get("/bedset/my_bedset/file_paths/{bedfiles}", include_in_schema=False) +@router.post("/bedset/my_bedset/file_paths", include_in_schema=True) async def get_mybedset_file_path( - bedfiles: str = Path(..., description="BED file indexs"), + md5sums: BEDLIST, remoteClass: RemoteClassEnum = Query( "http", description="Remote data provider class" ), @@ -794,12 +799,13 @@ async def get_mybedset_file_path( return list of file path for user defined bed """ - bfs = list(bedfiles.split(",")) + # idxs = list(bedfiles.split(",")) paths = "" - for bed in bfs: + for bed in md5sums.md5sums: + print(bed) hit = bbc.bed.select( - filter_conditions=[("id", "eq", bed)], + filter_conditions=[("md5sum", "eq", bed)], columns=[file_map_bed["bed"]], )[0] file = getattr(hit, file_map_bed["bed"]) @@ -822,7 +828,7 @@ async def get_mybedset_file_path( response = StreamingResponse( stream, media_type="text/csv", - headers={"Content-Disposition": f"attachment; filename={filename}.txt"}, ) + response.headers["Content-Disposition"] = f"attachment; filename={filename}" return response diff --git a/docs/changelog.md b/docs/changelog.md index b2160fb9..7d57bb4b 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format. +## [0.1.2] -- 2023-2-6 +### change +- change `/bedset/my_bedset/file_paths`endpoint from GET to POST + ## [0.1.1] -- 2021-10-30 ### change - `/bed/genomes` and `bedset/genomes`: impove speed diff --git a/requirements/requirements-all.txt b/requirements/requirements-all.txt index 7611cab4..234f0450 100644 --- a/requirements/requirements-all.txt +++ b/requirements/requirements-all.txt @@ -8,7 +8,7 @@ pipestat_reader python-multipart pyyaml requests -starlette==0.16.0 +starlette==0.22.0 uvicorn yacman>=0.7.1 setuptools