How to check how many calls are left in AlchemyAPI? python
A free AlchemyAPI user can make 1000 requests per day ( http://www.alchemyapi.com/products/pricing/ ).
I was accessing the API using python as such:
from alchemyapi import AlchemyAPI demo_text = 'Yesterday dumb Bob destroyed my fancy iPhone in beautiful Denver, Colorado. I guess I will have to head over to the Apple Store and buy a new one.' response = alchemyapi.keywords('text', demo_text) json_output = json.dumps(response, indent=4) print json_output
I know I ran out of calls as the requests were a response returning None.
How can I check how many calls I have left through python interface?
Will the invoice be verified as one request?
source to share
This URL will return you daily information used for calls.
Replace API_KEY with your key.
http://access.alchemyapi.com/calls/info/GetAPIKeyInfo?apikey=API_KEY&outputMode=json
source to share
You can keep a local variable that will keep track of the number of API calls and will be reset when the date changes using datetime.date from the date module.
source to share
You can also use this Java API like this:
AlchemyAPI alchemyObj = AlchemyAPI.GetInstanceFromFile("/../AlchemyAPI/testdir/api_key.txt");
AlchemyAPI_NamedEntityParams params= new AlchemyAPI_NamedEntityParams();
params.setQuotations(true); // for instance, enable quotations
Document doc = alchemyObj.HTMLGetRankedNamedEntities(htmlString, "http://news-site.com", params);
The last call will throw an IOException (if you exceed the allowed calls for the given day) and the message will be "API call failed: daily transaction limit".
Then you can catch it, wait 24 hours and try again.
source to share