Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upIt is impossible to retrieve stats by "DAY" granularity due to implementation #70
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
yuriybash commentedJun 29, 2016
•
edited
I am trying to retrieve stats for a set of promoted tweets for a specific, 7-day time range with
DAYgranularity. Here is what I'm doing (auth info omitted):This is the error I receive:
The server expects the start and end times to be in my local timezone (-5 from UTC), but when the params are being generated, the
to_timemethod is called, which strips the hour value from the datetime used. This happens here:https://github.com/twitterdev/twitter-python-ads-sdk/blob/master/twitter_ads/resource.py#L198-L205
https://github.com/twitterdev/twitter-python-ads-sdk/blob/master/twitter_ads/utils.py#L20-L32
All datetimes are set to midnight UTC, but the server expects the values to be midnight in the local timezone:
It is therefore effectively impossible to make make any stats requests with
DAILYgranularity, which is extremely important for our use case. Even if you omit theend_timeandstart_timeand use the defaults in_standard_params, it fails.In order to make a successful request, the timestamps used in the request must be:
start_time=2016-02-24T05:00:00Z&end_time=2016-03-01T05:00:00ZI've tested this and it works.
@brandonblack - saw that you wrote the
utilsmodule - any chance of getting this fixed soon? I'd be more than happy to open a PR myself to updateto_timeto take either a time-aware or time-unaware timestamp and format it accordingly.Thank you!