I am using the Elsevier API to access citation count data from Scopus, through the scopus-api module (but would be happy to use Elsevier's elsapy module). I can access the data I need, but there is a limit for the number of requests that can be made per week.
How would one obtain the number of remaining requests for the week?
All help is appreciated.
Although an old question, the answer might help someone else who stumbles across it. The quota related information is contained in the headers of the response to your request. Each API endpoint seems to have its own limit.
Here's an example of a response that still has something left of the quota:
{'allow': 'GET', 'Content-Encoding': 'gzip', 'Content-Type': 'application/xml;charset=UTF-8', 'Date': 'Fri, 26 Aug 2019 17:46:46 GMT', 'Server': 'Apache-Coyote/1.1', 'vary': 'Origin', 'X-ELS-APIKey': 'your-api-key-would-be-here', 'X-ELS-ReqId': '16385g19-b193-1308-5817-c5694db5619g', 'X-ELS-ResourceVersion': 'default', 'X-ELS-Status': 'OK', 'X-ELS-TransId': '16385g19-b193-1308-5817-c5694db5619g', 'X-RateLimit-Limit': '20000', 'X-RateLimit-Remaining': '19636', 'X-RateLimit-Reset': '2019-10-03 07:18:17', 'transfer-encoding': 'chunked', 'Connection': 'keep-alive'}
Here's an example for which the quota has been exceeded:
{'Content-Encoding': 'gzip', 'Content-Type': 'text/xml;charset=UTF-8', 'Date': 'Fri, 19 Aug 2019 17:46:46 GMT', 'Server': 'Apache-Coyote/1.1', 'X-ELS-Status': 'QUOTA_EXCEEDED - Quota Exceeded', 'X-RateLimit-Reset': '2019-08-26 05:51:01', 'Content-Length': '191', 'Connection': 'keep-alive'}
An example to get the headers in python using requests:
url = https://api.elsevier.com/content/abstract/scopus_id/85040730407?apiKey=yourapikey
response = requests.get(url)
print(response.headers)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With