Skip to main content

PredictHQ Event Intelligence

Project description

PredictHQ API Client for Python

https://badge.fury.io/gh/predicthq%2Fsdk-py.svg https://badge.fury.io/py/predicthq.svg https://travis-ci.org/predicthq/sdk-py.svg?branch=master https://coveralls.io/repos/github/predicthq/sdk-py/badge.svg?branch=master

PredictHQ is the demand intelligence company combining real-world events into one global source of truth to help businesses better understand demand and plan for the future.

Installation

pip install predicthq

Usage

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 phq.events.search(q="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 phq.events.search(q="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 phq.events.search(q="matisse", country="FR", offset=10, limit=5):
    print(event.rank, event.category, event.title, event.start.strftime('%Y-%m-%d'))

Endpoints

  • Client.oauth2

  • Client.accounts

  • Client.events

  • Client.signals

  • Client.places

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

Running Tests

pip install tox
tox

Found a Bug?

Please log an issue.

Project details


Release history Release notifications | RSS feed

This version

0.2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

predicthq-0.2.0-py2.py3-none-any.whl (19.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file predicthq-0.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: predicthq-0.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.14

File hashes

Hashes for predicthq-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a6ae4b1b2bab5f4da886c9f9279c8b5bd221f801c0b1f02bc7636a47dcf531fe
MD5 58a4197fad78caf618cb995831698317
BLAKE2b-256 5a746c5a4fa7cb16acf7ac31618d9a4779344f175b0ad7807569ba814972d4b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page