Closed cdiener closed 8 months ago
The tests for the Biomodels repo will fail now since the download API endpoint now triggers a redirect to the Biomodels FTP.
Code run:
from cobra.io import load_model load_model("BIOMD0000000633")
Traceback:
--------------------------------------------------------------------------- KeyError Traceback (most recent call last) File ~/code/cobrapy/src/cobra/io/web/load.py:127, in _cached_load(model_id, repositories) 126 try: --> 127 return cache[model_id] 128 except KeyError: File ~/code/envs/cobrapy/lib/python3.11/site-packages/diskcache/core.py:1234, in Cache.__getitem__(self, key) 1233 if value is ENOVAL: -> 1234 raise KeyError(key) 1235 return value KeyError: 'BIOMD0000000633' During handling of the above exception, another exception occurred: HTTPStatusError Traceback (most recent call last) File ~/code/cobrapy/src/cobra/io/web/load.py:160, in _fetch_model(model_id, repositories) 159 try: --> 160 return repository.get_sbml(model_id=model_id) 161 except OSError: File ~/code/cobrapy/src/cobra/io/web/biomodels_repository.py:93, in BioModels.get_sbml(self, model_id) 88 with self._progress, httpx.stream( 89 method="GET", 90 url=self._url.join(f"download/{model_id}"), 91 params={"filename": model.name}, 92 ) as response: ---> 93 response.raise_for_status() 94 task_id = self._progress.add_task( 95 description="download", 96 total=model.size, 97 model_id=model_id, 98 ) File ~/code/envs/cobrapy/lib/python3.11/site-packages/httpx/_models.py:749, in Response.raise_for_status(self) 748 message = message.format(self, error_type=error_type) --> 749 raise HTTPStatusError(message, request=request, response=self) HTTPStatusError: Redirect response '302 Found' for url 'https://www.ebi.ac.uk/biomodels/model/download/BIOMD0000000633?filename=BIOMD0000000633_url.xml' Redirect location: 'https://ftp.ebi.ac.uk/pub/databases/biomodels/repository/aaa/MODEL1603030000/3/BIOMD0000000633_url.xml' For more information check: https://httpstatuses.com/302 The above exception was the direct cause of the following exception: RuntimeError Traceback (most recent call last) Cell In[2], line 1 ----> 1 load_model("BIOMD0000000633") File ~/code/cobrapy/src/cobra/io/web/load.py:89, in load_model(model_id, repositories, cache) 40 """ 41 Download an SBML model from a remote repository. 42 (...) 86 87 """ 88 if cache: ---> 89 data = _cached_load( 90 model_id=model_id, 91 repositories=repositories, 92 ) 93 else: 94 data = _fetch_model(model_id=model_id, repositories=repositories) File ~/code/cobrapy/src/cobra/io/web/load.py:129, in _cached_load(model_id, repositories) 127 return cache[model_id] 128 except KeyError: --> 129 data = _fetch_model(model_id=model_id, repositories=repositories) 130 cache.set(key=model_id, value=data, expire=configuration.cache_expiration) 131 return data File ~/code/cobrapy/src/cobra/io/web/load.py:172, in _fetch_model(model_id, repositories) 168 logger.debug( 169 f"Model '{model_id}' not found in the {repository.name} repository." 170 ) 171 continue --> 172 raise RuntimeError( 173 f"The connection to the {repository.name} repository failed." 174 ) from error 175 except httpx.RequestError as error: 176 raise RuntimeError( 177 f"The connection to the {repository.name} repository failed." 178 ) from error RuntimeError: The connection to the BioModels repository failed.
Fix incoming.
Is there an existing issue for this?
Problem description
The tests for the Biomodels repo will fail now since the download API endpoint now triggers a redirect to the Biomodels FTP.
Code sample
Code run:
Traceback:
Environment
Anything else?
Fix incoming.