PredictHQ API Client for Python
Clone or download
Latest commit 1c97e10 Dec 12, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
predicthq Update readme and bump version to 0.0.17 Oct 8, 2018
tests add local_rank param Apr 2, 2018
.gitignore Initial release Feb 23, 2016
.travis.yml Add user-agent headers Sep 28, 2018
LICENSE Initial release Feb 23, 2016 Include version file in package Mar 1, 2016
README.rst Update README.rst Dec 12, 2018
setup.cfg Initial release Feb 23, 2016 Add user-agent headers Sep 28, 2018
tox.ini Initial release Feb 23, 2016


PredictHQ API Client for Python

PredictHQ combines real-world events into one global source of truth to help businesses better understand demand, and plan for the future.


pip install predicthq


from predicthq import Client

phq = Client(access_token="$ACCESS_TOKEN")

# the search() method returns an EventResultSet which allows you to iterate over the 1st page of items
for event in"Foo Fighters", rank_level=[4, 5], place={"scope": ["5391959", "5368361"]}):
    print(event.rank, event.category, event.title, event.start.strftime('%Y-%m-%d'))

# if you want to iterate over all the results for your query, you can chain the iter_all() generator
for event in"matisse", country="FR").iter_all():
    print(event.rank, event.category, event.title, event.start.strftime('%Y-%m-%d'))

# you can skip results with the offset parameter and limit the number of results with the limit parameter
# the following skips the first 10 results and limits the results to 5 items
for event in"matisse", country="FR", offset=10, limit=5):
    print(event.rank, event.category, event.title, event.start.strftime('%Y-%m-%d'))


  • Client.oauth2
  • Client.accounts
  • Client.signals
  • Client.places

For a description of all available endpoints, refer to our API Documentation.

Running Tests

pip install tox

Found a Bug?

Please log an issue.