Python SDK
The official PredictHQ Python Client provides a consistent, pythonic interface to our API.
pip install predicthq
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")
Perform a basic search of events 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.Last modified 2mo ago