bioperl / Bio-EUtilities

Low-level OO Perl interface for NCBI's eutils
4 stars 5 forks source link

api key value causes issue son programs if empty #14

Closed carandraug closed 4 years ago

carandraug commented 4 years ago

entrez requests require an email for a few years. However, in practice it works fine without email. Similarly, entrez now requires an API key but in practice it works fine if it's omitted.

The difference is that an email address can be an empty value on the request but the API key must be a valid value. Example:

# this works fine
curl -s "https://eutils.ncbi.nlm.nih.gov/ ...&email=<valid-email>&api_key=<valid-key>"
# this works fine too (email is empty)
curl -s "https://eutils.ncbi.nlm.nih.gov/ ...&email="
# this fails (api_key can't be empty)
curl -s "https://eutils.ncbi.nlm.nih.gov/ ...&api_key="

Which in bioperl code means:

# this works fine
Bio::DB::EUtilities->new(..., email => 'valid-email', api_key => 'valid-key')->get_Response();
# this works fine too (email is empty)
Bio::DB::EUtilities->new(..., email => '')->get_Response();
# this fails (api_key can't be empty)
Bio::DB::EUtilities->new(..., api_key => 'valid-key')->get_Response();

However, the recent change to the scripts to add this option (5cb77f4f0aaec24c4e9318265bdac6c479136583 ) makes api_key an optional but no input check so it bp_genbank_ref_extractor just fails unless api-key is specified.

The check for api_key can be done on bp_genbank_ref_extractor or on Bio::Tools::EUtilities::EUtilParameters but I'm leaning towards the first.

carandraug commented 4 years ago

This is now fixed. @cjfields would you mind making a 1.77 release?

cjfields commented 4 years ago

@carandraug will do (before I get too tied up)

carandraug commented 4 years ago

Thanks. I tried to make a release myself but indexed failed because I didn't had the permissions. Hopefully, my previous failed attempt will not cause issues for you.

cjfields commented 4 years ago

@carandraug easy enough to bump the version if a problem arises. Was the permissions problem general or from lack of permissions in a specific module? I can check on PAUSE.

carandraug commented 4 years ago

Was the permissions problem general or from lack of permissions in a specific module? I can check on PAUSE.

The error I got was "Not indexed; CDRAUG not authorized for this distribution name". No need to fix it, I don't need those permissions if you can make the release which hopefully is just a dzil release away.

cjfields commented 4 years ago

@carandraug it's now on CPAN. Thanks for adding; I may investigate more on the PAUSE perms if you need to make further changes .