How to use NCBI API key for Entrez (Biopython)?
2
0
Entering edit mode
23 months ago
William • 0

Hello all,

I have a script that fetches DOI for papers that were found given search term. However if I don't set Entrez.mail I get a warning saying "To make use of NCBI's E-utilities, NCBI requires you to specify your email address with each request."

When using only a mail, you are limited to 3 requests per second. I need this limit to go up, which is why I requested an API key. The issue is that it does not seem to recognize the API key at all. I set it like so:

# Entrez.email = getenv('EntrezMail')
Entrez.api_key = getenv('EntrezAPI')

In other words I am loading it from an .env file. I have checked and made sure that it is working by printing the results of getenv(). Why doesn't it work? Am I doing something wrong?

NCBI Entrez • 1.7k views
ADD COMMENT
0
Entering edit mode
23 months ago
GenoMax 141k

You can simply set an environment variable in your shell.

export NCBI_API_KEY='abcdef012'

Add to your shell initialization file to have it set automatically.

ADD COMMENT

Login before adding your answer.

Traffic: 1951 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6