chembl / chembl_webresource_client

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

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

Closed FelPVic closed 2 years ago

FelPVic commented 2 years ago

Grettings I will try to extract some activities and pass to dataframe with this code:

      ` ### Conect with ChEMBL API            
        activity =  new_client.activity
        target = new_client.target
        listOfActivities = activity.filter(target_chembl_id=id).filter(
                standard_type="IC50").filter(standard_units="nM").only(
                    "canonical_smiles", "molecule_chembl_id", "pchembl_value", 
                    "standard_units", "standard_value"
                )
        if not listOfActivities:
            print("Error in ChEMBL ID")
        else:
            targetInfo = target.filter(target_chembl_id=id).only(
                "pref_name", "target_type"
                )
            targetData = pd.DataFrame(targetInfo)
            targetName = targetData["pref_name"][0]
            targetData["activities_founded"] = len(listOfActivities)
          ### Do a dataframe and calculate pIC50
          dfActivities = pd.DataFrame(listOfActivities)`

But the script returns this error in some ocations:

  `File "/nfs/home/dvictori/Documents/chembl/chembl_activites.py", line 50, in <module>
      dfActivities = pd.DataFrame(listOfActivities)
    File "/nfs/home/dvictori/anaconda3/envs/rdkit/lib/python3.9/site-packages/pandas/core/frame.py", line 710, in __init__
      data = list(data)
    File "/nfs/home/dvictori/anaconda3/envs/rdkit/lib/python3.9/site-packages/chembl_webresource_client/query_set.py", line 127, in __next__
      return self.next()
    File "/nfs/home/dvictori/anaconda3/envs/rdkit/lib/python3.9/site-packages/chembl_webresource_client/query_set.py", line 115, in next
      self.chunk = self.query.next_page()
    File "/nfs/home/dvictori/anaconda3/envs/rdkit/lib/python3.9/site-packages/chembl_webresource_client/url_query.py", line 434, in next_page
      return self.get_page()
    File "/nfs/home/dvictori/anaconda3/envs/rdkit/lib/python3.9/site-packages/chembl_webresource_client/url_query.py", line 394, in get_page
      handle_http_error(res)
    File "/nfs/home/dvictori/anaconda3/envs/rdkit/lib/python3.9/site-packages/chembl_webresource_client/http_errors.py", line 113, in handle_http_error
      raise exception_class(request.url, request.text)
  chembl_webresource_client.http_errors.HttpApplicationError: Error for url https://www.ebi.ac.uk/chembl/api/data/activity.json, server response: <!doctype html>
  <!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
  <!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
  <!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en"> <![endif]-->
  <!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en"> <![endif]-->
  <!-- Consider adding an manifest.appcache: h5bp.com/d/Offline -->
  <!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
  <head>
      <meta charset="utf-8">

<!-- Use the .htaccess and remove these lines to avoid edge case issues.
 More info: h5bp.com/b/378 -->
<!-- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> --> <!-- Not yet implemented -->

<title>Server error &lt; EMBL-EBI</title>
<meta name="description" content="EMBL-EBI"><!-- Describe what this page is about -->
<meta name="keywords" content="bioinformatics, europe, institute"><!-- A few keywords that relate to the content of THIS PAGE (not the whol project) -->
<meta name="author" content="EMBL-EBI"><!-- Your [project-name] here -->

<!-- Mobile viewport optimized: j.mp/bplateviewport -->
<meta name="viewport" content="width=device-width,initial-scale=1">

<!-- Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons -->

<!-- CSS: implied media=all -->
<!-- CSS concatenated and minified via ant build script-->
<link rel="stylesheet" href="//www.ebi.ac.uk/web_guidelines/css/compliance/develop/boilerplate-style.css">
<link rel="stylesheet" href="//www.ebi.ac.uk/web_guidelines/css/compliance/develop/ebi-global.css" type="text/css" media="screen">
<link rel="stylesheet" href="//www.ebi.ac.uk/web_guidelines/css/compliance/develop/ebi-visual.css" type="text/css" media="screen">
<link rel="stylesheet" href="//www.ebi.ac.uk/web_guidelines/css/compliance/develop/984-24-col-fluid.css" type="text/css" media="screen">

<!-- you can replace this with [projectname]-colours.css. See http://frontier.ebi.ac.uk/web/style/colour for details of how to do this -->
<!-- also inform ES so we can host your colour palette file -->
<link rel="stylesheet" href="//www.ebi.ac.uk/web_guidelines/css/compliance/develop/embl-petrol-colours.css" type="text/css" media="screen">

<!-- for production the above can be replaced with -->
<!--
<link rel="stylesheet" href="//www.ebi.ac.uk/web_guidelines/css/compliance/mini/ebi-fluid-embl.css">
-->

<!-- end CSS-->

<!-- All JavaScript at the bottom, except for Modernizr / Respond.
  Modernizr enables HTML5 elements & feature detects; Respond is a polyfill for min/max-width CSS3 Media Queries
  For optimal performance, use a custom Modernizr build: www.modernizr.com/download/ -->

<!-- Full build -->
<!-- <script src="//www.ebi.ac.uk/web_guidelines/js/libs/modernizr.minified.2.1.6.js"></script> -->

<!-- custom build (lacks most of the "advanced" HTML5 support -->
<script src="//www.ebi.ac.uk/web_guidelines/js/libs/modernizr.custom.49274.js"></script>

      </head>

      <body class="level1 page-error"><!-- add any of your classes or IDs -->
      <div id="skip-to">
          <ul>
              <li><a href="#content">Skip to main content</a></li>
              <li><a href="#local-nav">Skip to local navigation</a></li>
              <li><a href="#global-nav">Skip to EBI global navigation menu</a></li>
              <li><a href="#global-nav-expanded">Skip to expanded EBI global navigation menu (includes all sub-sections)</a></li>
          </ul>
      </div>

  <div id="wrapper" class="container_24">
      <header>
                                  <div id="global-masthead" class="masthead grid_24">
              <!--This has to be one line and no newline characters-->
              <a href="//www.ebi.ac.uk/" title="Go to the EMBL-EBI homepage"><img src="//www.ebi.ac.uk/web_guidelines/images/logos/EMBL-EBI/EMBL_EBI_Logo_white.png" alt="EMBL European Bioinformatics Institute"></a>

          <nav>
              <ul id="global-nav">
                  <!-- set active class as appropriate -->
                                      <li id="services" class=" first "><a href="//www.ebi.ac.uk/services" title="Services">Services</a></li>
                                      <li id="research" class=""><a href="//www.ebi.ac.uk/research" title="Research">Research</a></li>
                                      <li id="training" class=""><a href="//www.ebi.ac.uk/training" title="Training">Training</a></li>
                                      <li id="industry" class=""><a href="//www.ebi.ac.uk/industry" title="Industry">Industry</a></li>
                                      <li id="about" class=" last"><a href="//www.ebi.ac.uk/about" title="About us">About us</a></li>
                                  </ul>
          </nav>

      </div>
                              <div id="local-masthead" class="masthead grid_24 nomenu">

          <!-- local-title -->
          <!-- NB: for additional title style patterns, see http://frontier.ebi.ac.uk/web/style/patterns -->

      <div class="" id="local-title">
                                                                  <h1><a href="/" title="Back to Server error homepage">Server error</a></h1>
                                          </div>

      <!-- /local-title -->

</div>
</header>

<div id="content" role="main" class="grid_24 clearfix">
        <!-- Example layout containers -->
    <section>
        <section class="grid_24">

<div class="content">
  <div>

<div class="content">
  <div>
  <div>
        <div>
      <h2 class="alert">Something has gone wrong with our web server</h2>
      <p>Our web server says this is a <span class="alert">500 internal server error</span>: the request cannot be carried out by the server.<br />
      This problem means that the service you are trying to access is currently unavailable. We're very sorry.</p>
      <p>Please try again but if it keeps happening, you can <a fix="h-" href="//www.ebi.ac.uk/support">contact us</a> and we will try to help you.</p>
      </div>
            </div>
      </div>
        </div>

      </div>
        </div>

  <div class="content">
    <form id="ebi_search" action="/ebisearch/search.ebi">
  <fieldset><legend><span>Explore the EBI:</span></legend>
    <input id="query" title="EB-eye Search" tabindex="1" type="text" name="query" value="" size="35" maxlength="2048" style="width: 80%" /><input id="search_submit" class="submit" tabindex="2" type="submit" value="Search" name="submit" /><input id="allebi" type="hidden" name="db" value="allebi" checked="checked" /><input type="hidden" name="requestFrom" value="ebi_error" /><div>
     <p id="example">Examples: <a href="/ebisearch/search.ebi?db=allebi&amp;requestFrom=ebi_error&amp;query=blast">blast</a>, <a href="/ebisearch/search.ebi?db=allebi&amp;query=keratin&amp;requestFrom=ebi_error">keratin</a>, <a href="/ebisearch/search.ebi?db=allebi&amp;query=bfl1&amp;requestFrom=ebi_error">bfl1</a>...</p>
    </div>
  </fieldset></form>  </div>

              </section>    </section>

      <!-- End example layout containers -->

        </div>

        <footer>

  <!-- Optional local footer (insert citation / project-specific copyright / etc here -->
      <!--
      <div id="local-footer" class="grid_24 clearfix">
    <p>How to reference this page: ...</p>
  </div>
      -->
      <!-- End optional local footer -->

  <div id="global-footer" class="grid_24">

      <nav id="global-nav-expanded">

          <div class="grid_4 alpha">
              <h3 class="embl-ebi"><a href="//www.ebi.ac.uk/" title="EMBL-EBI">EMBL-EBI</a></h3>
          </div>

          <div class="grid_4">
              <h3 class="services"><a href="//www.ebi.ac.uk/services">Services</a></h3>
          </div>

          <div class="grid_4">
              <h3 class="research"><a href="//www.ebi.ac.uk/research">Research</a></h3>
          </div>

          <div class="grid_4">
              <h3 class="training"><a href="//www.ebi.ac.uk/training">Training</a></h3>
          </div>

          <div class="grid_4">
              <h3 class="industry"><a href="//www.ebi.ac.uk/industry">Industry</a></h3>
          </div>

          <div class="grid_4 omega">
              <h3 class="about"><a href="//www.ebi.ac.uk/about">About us</a></h3>
          </div>

      </nav>

      <section id="ebi-footer-meta">
                    <p class="address">EMBL-EBI, Wellcome Trust Genome Campus, Hinxton, Cambridgeshire, CB10 1SD, UK &nbsp; &nbsp; +44 (0)1223 49 44 44</p>
                    <p class="legal">Copyright &copy; EMBL-EBI 2013 | EBI is an Outstation of the <a href="http://www.embl.org">European Molecular Biology Laboratory</a> | <a href="/about/privacy">Privacy</a> | <a href="/about/cookies">Cookies</a> | <a href="/about/terms-of-use">Terms of use</a></p>
                </section>

            </div>

        </footer>
        </div> <!--! end of #wrapper -->

        <!-- JavaScript at the bottom for fast page loading -->

        <!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->
        <!--
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
        <script>window.jQuery || document.write('<script src="../js/libs/jquery-1.6.2.min.js"><\/script>')</script>
        -->

        <!-- Your custom JavaScript file can go here... change names accordingly -->
        <script defer="defer" src="//www.ebi.ac.uk/web_guidelines/js/cookiebanner.js"></script>
        <script defer="defer" src="//www.ebi.ac.uk/web_guidelines/js/foot.js"></script>
        <!-- end scripts-->

        <!-- Google Analytics details... -->
        <!-- Change UA-XXXXX-X to be your site's ID -->
        <!--
        <script>
          window._gaq = [['_setAccount','UAXXXXXXXX1'],['_trackPageview'],['_trackPageLoadTime']];
          Modernizr.load({
            load: ('https:' == location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js'
          });
        </script>
        -->

        <!-- Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6.
        chromium.org/developers/how-tos/chrome-frame-getting-started -->
        <!--[if lt IE 7 ]>
        <script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
        <script>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>
        <![endif]-->

        </body>
        </html>

` I am doing any wrong?

PARODBE commented 2 years ago

Hi,

I obtain the same error, any solutions for this?

eloyfelix commented 2 years ago

Hi,

Are you still having issues with it? Could you please share a minimal reproducible example without using other third libraries (pandas...)?

The web services (this library is working on top of it) seems to be working fine.

@juanfmx2

PARODBE commented 2 years ago

Now, it is working fine.

Thanks!

YojanaGadiya commented 1 year ago

@eloyfelix I get the same error. It looks like the error probably arises due to the results containing truncated data cell no.9 in the example notebook. This causes the breaking of the loop at some point. Please can you suggest a way to extract all the results without any truncation?

Thank You.

khanmf commented 1 year ago

@eloyfelix @PARODBE @FelPVic @YojanaGadiya I am getting the same error. Please help me in resolving the issue if anyone of you guyz know the solution.

Thanks in advance

ailnicka commented 1 year ago

I'm also getting this error (500) now, whenever I have a longer list of targets for which I try to get activities. Is there a problem with EBI server?