predicthq/sdk-py

Cannot pull data with respect to time

Closed this issue · 2 comments

Cannot pull data with respect to time

Hi @J-4-Josh Thanks for notifying us about this.

Please note that all event start/end datetimes are returned from our API in UTC timezone. I have provided an example to clarify.

In [1]: from predicthq import Client
In [2]: ACCESS_TOKEN = 'your access token goes here'

In [3]: phq = Client(access_token=ACCESS_TOKEN)

In [4]: start = {
   ...:     'gte': '2022-08-02T14:00:00',
   ...:     'lte': '2022-08-02T15:00:00',
   ...:     'tz': 'America/Chicago',
   ...: }
   ...: 
   ...: for event in phq.events.search(start=start, country='USA'):
   ...:     print(event.rank, event.category, event.title, event.start.strftime('%Y-%m-%d %H:%M:%S %Z'))
   ...: 
20 airport-delays Moderate Delays - Iliamna Airport (ILI) 2022-08-02 20:00:00 UTC
0 concerts Benoir 2022-08-02 20:00:00 UTC
47 expos Philadelphia Wedding Expo 2022-08-02 20:00:00 UTC
20 airport-delays Moderate Delays - Unalakleet Airport (UNK) 2022-08-02 20:00:00 UTC
90 airport-delays Moderate to Severe Delays - Albert J Ellis Airport (OAJ) 2022-08-02 20:00:00 UTC
0 concerts Mike Felten 2022-08-02 20:00:00 UTC
0 community Kurt Gott - Singer/Songwriter/Musician 2022-08-02 20:00:00 UTC
90 airport-delays Moderate to Severe Delays - Easterwood Airport (CLL) 2022-08-02 20:00:00 UTC
40 performing-arts Mac King 2022-08-02 20:00:00 UTC
21 severe-weather Storm - North America - United States 2022-08-02 20:00:00 UTC

If you please provide us with an example of what you were trying to do and the output you received it will help us investigate and assist you further.

Hi @J-4-Josh ,

I am closing this issue as it has been stale for a while. Please feel free to re-open it if we can assist further.

Thank you,
Matthieu