File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,7 +93,11 @@ async def get_textified_wd(
9393 entities = {}
9494 if len (qids ) == 1 :
9595 # When one QID is requested, TTL is used
96- entity_data = utils .get_wikidata_ttl_by_id (qids [0 ], lang = lang )
96+ try :
97+ entity_data = utils .get_wikidata_ttl_by_id (qids [0 ], lang = lang )
98+ except requests .HTTPError :
99+ entity_data = None
100+
97101 if not entity_data :
98102 response = "ID not found"
99103 raise HTTPException (status_code = 404 , detail = response )
@@ -117,7 +121,10 @@ async def get_textified_wd(
117121 }
118122 else :
119123 # JSON is used with Action API for bulk retrieval
120- entity_data = utils .get_wikidata_json_by_ids (qids )
124+ try :
125+ entity_data = utils .get_wikidata_json_by_ids (qids )
126+ except requests .HTTPError :
127+ entity_data = None
121128 if not entity_data :
122129 response = "IDs not found"
123130 raise HTTPException (status_code = 404 , detail = response )
You can’t perform that action at this time.
0 commit comments