chembl / chembl_webresource_client

Official Python client for accessing ChEMBL API
https://www.ebi.ac.uk/chembl/api/data/docs
Other
360 stars 95 forks source link

HttpApplicationError #129

Closed meghanakaranam1 closed 1 year ago

meghanakaranam1 commented 1 year ago

hi, I'm getting this error. Is there a problem with my code, or is the api having any server side issues? please help me out on this @eloyfelix @nclopezo @mnowotka @fredrikw @sshojiro

image

Acario commented 1 year ago

I am getting the same error. My code was working fine two weekends ago. Today I tried it on the same compound as two weeks ago and this error came up. I would like to know what is going on as well here.

fredrikw commented 1 year ago

Hello, Did you check if the api hade any problems? Do you have a minimum reproducible example? It would be a lot better if you copied and pasted the code and error message as text instead of a screen shot. For one, it's possible to copy and paste to test instead of typing everything manually. Also, you have cut the error message, did it include anymore specifics on the server error? I don't have the library installed on my main computer at the moment so I can't easily try but the API seems to work. (Checkable at https://www.ebi.ac.uk/chembl/api/data/docs)

Acario commented 1 year ago

Here is the code I am running:

from chembl_webresource_client.new_client import new_client

Here is the error:

`Exception Traceback (most recent call last) Input In [1], in <cell line: 1>() ---> 1 from chembl_webresource_client.new_client import new_client

File ~\anaconda3\lib\site-packages\chembl_webresource_client\new_client.py:65, in 60 return client 63 #----------------------------------------------------------------------------------------------------------------------- ---> 65 new_client = client_from_url(Settings.Instance().NEW_CLIENT_URL + '/spore')

File ~\anaconda3\lib\site-packages\chembl_webresource_client\new_client.py:27, in client_from_url(url, base_url) 25 res = requests.get(url) 26 if not res.ok: ---> 27 raise Exception('Error getting schema from url {0} with status {1} and msg {2}'.format(url, res.status_code, res.text)) 28 schema = res.json() 29 if 'base_url' not in schema:

Exception: Error getting schema from url https://www.ebi.ac.uk/chembl/api/data/spore with status 500 and msg <!doctype html>

Error: 500 | EMBL’s European Bionformatics Institute

Error: 500

There was a technical error.

Something has gone wrong with our web server when attempting to make this page.

Unfortunately, the service you are trying to access is currently unavailable.
Please try again later.

Example searches: blast keratin bfl1 | About EBI Search

Need assistance?

Contact our support team
`
Acario commented 1 year ago

Sometimes it does successfully load the package but then I try to run the package over some compounds and get this below.

Code: chembl_ids=[] for h in range(0,len(comps)): molecule=new_client.molecule molS=molecule.filter(molecule_synonyms__molecule_synonym__iexact=comps[h]) if len(molS)>0: chembl_ids.append(molS[0]['molecule_chembl_id']) # Synonym hit else: chembl_ids.append(0)

This is the error here:

`HttpApplicationError Traceback (most recent call last) Input In [11], in <cell line: 2>() 3 molecule=new_client.molecule 4 molS=molecule.filter(molecule_synonyms__molecule_synonym__iexact=comps[h]) ----> 5 if len(molS)>0: 6 chemblSyn.append(molS[0]['molecule_chembl_id']) # Synonym hit 7 else:

File ~\anaconda3\lib\site-packages\chembl_webresource_client\query_set.py:97, in QuerySet.len(self) 95 if not self.can_filter: 96 return 1 ---> 97 return len(self.query)

File ~\anaconda3\lib\site-packages\chembl_webresource_client\url_query.py:144, in UrlQuery.len(self) 142 return 143 if not self.api_total_count: --> 144 self.get_page() 145 return self.api_total_count

File ~\anaconda3\lib\site-packages\chembl_webresource_client\url_query.py:394, in UrlQuery.get_page(self) 392 self.logger.info('From cache: {0}'.format(res.from_cache if hasattr(res, 'from_cache') else False)) 393 if not res.ok: --> 394 handle_http_error(res) 395 if self.frmt == 'json': 396 json_data = res.json()

File ~\anaconda3\lib\site-packages\chembl_webresource_client\http_errors.py:113, in handle_http_error(request) 111 exception_class = status_to_exception.get(request.status_code, BaseHttpException) 112 if request.text: --> 113 raise exception_class(request.url, request.text) 114 raise exception_class(request.url, request.content)

HttpApplicationError: Error for url https://www.ebi.ac.uk/chembl/api/data/molecule.json, server response: <!doctype html>

Error: 500 | EMBL’s European Bionformatics Institute

Error: 500

There was a technical error.

Something has gone wrong with our web server when attempting to make this page.

Unfortunately, the service you are trying to access is currently unavailable.
Please try again later.

Example searches: blast keratin bfl1 | About EBI Search

Need assistance?

Contact our support team

`

eloyfelix commented 1 year ago

@juanfmx2 @nclopezo could you please take a look at it?

cc: @BZdrazil @FionaEBI

fredrikw commented 1 year ago

It's working perfectly fine for me both through the package and directly on the API docs page. Most likely they had some problems on the API side. The error messages certainly indicates that. You get a 500-error from the API. So I wouldn't say it's a bug with the client package.

juanfmx2 commented 1 year ago

@fredrikw @Acario @meghanakaranam1 sorry for the late response, we were having intermittent issues with our infrastructure, but the service should be stable now. Please let me know if you are experiencing any other issues.

Acario commented 1 year ago

Thanks for the help @fredrikw @juanfmx2!