Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/351.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何检查AlchemyAPI中还有多少呼叫?python_Python_Json_Rest_Nlp_Alchemyapi - Fatal编程技术网

如何检查AlchemyAPI中还有多少呼叫?python

如何检查AlchemyAPI中还有多少呼叫?python,python,json,rest,nlp,alchemyapi,Python,Json,Rest,Nlp,Alchemyapi,AlchemyAPI的免费用户每天可以调用1000个请求() 我一直在使用python访问API,如下所示: 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.'

AlchemyAPI的免费用户每天可以调用1000个请求()

我一直在使用python访问API,如下所示:

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
我知道我的电话用完了,因为请求没有回应

如何检查通过python接口剩下多少调用?


检查是否会算作一个请求?

您可以保留一个局部变量,用于跟踪API调用的数量,并在日期更改时使用from date模块进行重置

您可以从中使用alchemy\u调用\u left(api\u键)函数


不,它本身不算通话。

此URL将返回您的每日通话使用信息

用您的密钥替换API_密钥


您也可以按如下方式使用此Java:

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);
最后一次调用将导致IOException(如果您在给定的一天内超过了允许的调用),消息将是“错误进行API调用:超出每日事务限制”


然后,您可以捕获它,等待24小时,然后重试。

如果上述用户停止并启动程序,此逻辑将不起作用。局部变量将重新初始化为零。