Repository navigation
Usage tracking
When using Event Registry through the API, your actions consume so-called tokens. Different queries can use a different number of tokens. The tokens and their use are described in detail on the pricing page.
Access to the data in Event Registry depends on your account. If you are a free user without a paid licence, you can perform a limited number of requests and are allowed to use a limited set of functionalities (for example, data is limited to the last month only). The users without a paid licence are also not allowed to use the obtained data for commercial purposes. The terms of service are described on the Terms of Service page. In order to avoid these restrictions please contact us about the available plans.
The SDK provides several methods for tracking how many tokens/requests you have used:
-
EventRegistry.getUsageInfo()returns the number of used and total available tokens for your account, as a dict with theusedTokensandavailableTokensproperties. It can be called at any time. -
EventRegistry.getRemainingAvailableRequests()andEventRegistry.getDailyAvailableRequests()return the remaining and the total number of requests for the day. The values are populated from the response headers, so they are available only after at least one request has been made. -
EventRegistry.printLastReqStats()prints how many tokens were used by the last executed request and whether the archive was used.
from eventregistry import *
er = EventRegistry(apiKey = YOUR_API_KEY)
usage = er.getUsageInfo()
print("used %s of %s tokens" % (usage["usedTokens"], usage["availableTokens"]))
res = er.execQuery(QueryArticles(keywords = "Tesla"))
# prints the number of tokens used by the request, the performed action and whether the archive was used
er.printLastReqStats()Queries that search the archive (content older than 31 days) use more tokens than queries on the recent content. If you only need recent content, create the instance with EventRegistry(allowUseOfArchive = False). What happens when you run out of tokens and how to avoid making too many requests at once is described on the Errors and troubleshooting page; the Quickstart recipes explain how many requests an iterator makes.
Core Information
Usage tracking
Terminology
EventRegistry class
ReturnInfo class
Data models for returned information
Finding concepts for keywords
Filtering content by news sources
Errors and troubleshooting
Migration guide (v10, v11)
Text analytics
Semantic annotation, categorization, sentiment
Searching
Searching for events
Searching for articles
Searching for mentions
Article/event info
Get event information
Get article information
Other
Supported languages
Different ways to search using keywords
Topic pages
Feed of new articles/events
Daily trends
Number of mentions in the news
Find the event for your own text
Article URL to URI mapping
API reference