mgbam commited on
Commit
2e162a8
·
verified ·
1 Parent(s): ec53fe0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -184,11 +184,15 @@ def _get_bioportal_data(ontology: str, term: str) -> Optional[Dict]:
184
  }
185
 
186
  url = f"{API_ENDPOINTS['bioportal']}/search"
187
-
188
  try:
189
  response = requests.get(url, headers=headers, params=params, timeout=15)
190
  response.raise_for_status()
191
- return response.json()
 
 
 
 
 
192
  except requests.exceptions.RequestException as e:
193
  st.error(f"BioPortal API request failed: {e} Please check connectivity and ensure you have the correct API Key.")
194
  logging.error(f"BioPortal API request failed: {e}")
 
184
  }
185
 
186
  url = f"{API_ENDPOINTS['bioportal']}/search"
 
187
  try:
188
  response = requests.get(url, headers=headers, params=params, timeout=15)
189
  response.raise_for_status()
190
+ data = response.json()
191
+ if data and 'collection' in data:
192
+ return data
193
+ else:
194
+ st.warning("No results found for the BioPortal query.")
195
+ return None
196
  except requests.exceptions.RequestException as e:
197
  st.error(f"BioPortal API request failed: {e} Please check connectivity and ensure you have the correct API Key.")
198
  logging.error(f"BioPortal API request failed: {e}")