Python SDK
Installation
pip install predicthq
Example Usage
Initialising the SDK
from predicthq import Client
# Initialises PredictHQ client library using your access token.
# Note: You can find/create your access token at https://control.predicthq.com/clients
phq = Client(access_token="$ACCESS_TOKEN")
Event Search
# Basic event search using the q, rank_level and country parameters.
for event in phq.events.search(q="Foo Fighters", rank_level=[4, 5], country='US'):
print(event.rank, event.category, event.title, event.start.strftime('%Y-%m-%d'))
By default, the event search will only return the first ten results. If you want to paginate or access more results at once, please look at either using limit/offset parameters or at using the iter_all()
helper.
Further examples
Please browse through our use case examples on our GitHub repository.
Found a Bug?
Please log an issue on our GitHub repository.