File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 1010 get_diagram_url ,
1111 get_diagram_image ,
1212 fetch_biomodel_applications_files ,
13+ fetch_publications ,
1314)
1415
1516
@@ -132,3 +133,24 @@ async def get_biomodel_applications_files_controller(biomodel_id: str) -> dict:
132133 )
133134 except Exception as e :
134135 raise HTTPException (status_code = 500 , detail = str (e ))
136+
137+
138+ async def get_publications_controller () -> List [dict ]:
139+ """
140+ Controller function to fetch publications from the VCell API.
141+ Raises:
142+ HTTPException: If the VCell API request fails.
143+ """
144+ try :
145+ publications = await fetch_publications ()
146+ return publications
147+ except httpx .HTTPStatusError as e :
148+ raise HTTPException (
149+ status_code = e .response .status_code , detail = "Error fetching publications."
150+ )
151+ except httpx .RequestError as e :
152+ raise HTTPException (
153+ status_code = 500 , detail = "Error communicating with VCell API."
154+ )
155+ except Exception as e :
156+ raise HTTPException (status_code = 500 , detail = str (e ))
Original file line number Diff line number Diff line change 99 get_diagram_url_controller ,
1010 get_diagram_image_controller ,
1111 get_biomodel_applications_files_controller ,
12+ get_publications_controller ,
1213)
1314
1415router = APIRouter ()
@@ -89,3 +90,14 @@ async def get_biomodel_applications_files(biomodel_id: str):
8990 return await get_biomodel_applications_files_controller (biomodel_id )
9091 except HTTPException as e :
9192 raise e
93+
94+
95+ @router .get ("/publications" , response_model = List [dict ])
96+ async def get_publications ():
97+ """
98+ Endpoint to retrieve publications from the VCell API.
99+ """
100+ try :
101+ return await get_publications_controller ()
102+ except HTTPException as e :
103+ raise e
You can’t perform that action at this time.
0 commit comments