Python SDK

The official PredictHQ Python Client provides a consistent, pythonic interface to our API.



pip install predicthq

Setup the SDK

from predicthq import Client

# Initialises PredictHQ client library using your access token.
# Note: You can find/create your access token at
phq = Client(access_token="$ACCESS_TOKEN")

Search Events

Perform a basic search of events using the q, rank_level and country parameters.

for event in"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 an Issue?

Please log an issue on our GitHub repository.

Last updated

© 2024 PredictHQ Ltd