Status 429 with message "Too Many Requests" in response to NCBI URL

6 views (last 30 days)
I'm trying to access protein information from NCBI using the 'getgenpept' command but I get this error and my computer crashes after. I'm wondering if I could get some assistance with fixing this issue.
s = getgenpept('C4QWH2');

Answers (1)

Arthur Goldsipe
Arthur Goldsipe on 29 Jul 2021
As described here, you are seeing the error because NCBI limits the number of queries from a particular IP address to 3 per second, unless you use an API key. We plan to update the Bioinformatics Toolbox functions to support the use of API keys in a future release.
In this paticular case, the problem is that multiple queries happen as getgenpept tries different query options. I can think of a few ways to work around this. One solution would be to put a small pause between queries. If you have permission to edit the files in your installation, you could edit getncbidata.m (located in folder <matlabroot>\toolbox\bioinfo\bioinfo\private) and insert something like pause(0.5) just before the end of the for loop that includes a call to webread. If you don't have permission to edit this file, you could also manually pause by setting a breakpoint at a similar location and wait a second before continuing whenever you hit the breakpoint.
-Arthur (he/him)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!