Ads API Performance - Tweet Stats



I been using the Python Ads API v1 for fairly successfully for a while now, but recently (starting approx mid-September 2016), the performance of calls to the API for promoted tweet stats has gone down drastically.

Calls made via “queue_async_stats_job” that used to take a few seconds to return results for 1 or 2 tweets for an Account, are now taking 2,3 or 4 minutes (inconsistently), and sometimes fail completely with errors such as: “requests.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:581)”

It does not seem to matter the time window used in the request - the same issue happens when requesting 1 day’s worth of data, a week’s worth or for a month (I know requesting a month’s worth is not ideal).



Hey @stevea.jones,

Can you try calling those endpoints using twurl and let us know the entire request and response bodies, as well as the expected vs actual response? I suspect that the issue may be linked to our backend, as opposed to the SDK itself. Additionally, we have seen issues around async stats jobs being delayed, and we’ve responded to those on this thread:

Hope that helps!


Thanks for your response. twurl is Ruby-based, correct? I don’t have Ruby nor the expertise to use it. But here is a sample request and resulting data as generated by Python (note that this did not take an extraordinary long time to run - as I mentioned, the performance degradation is not consistent - for the same request, it may come back right away, or take several minutes. Not sure if the time of day then the request is made matters? It seems to be a bit faster in the afternoon as compare to the morning.

{u’request’: {u’params’: {u’placement’: u’ALL_ON_TWITTER’, u’metric_groups’: [u’ENGAGEMENT’, u’BILLING’, u’VIDEO’], u’country’: None, u’start_time’: u’2016-09-02T23:00:00Z’, u’entity’: u’PROMOTED_TWEET’, u’platform’: None, u’end_time’: u’2016-09-03T03:00:00Z’, u’granularity’: u’HOUR’, u’entity_ids’: [u’ypf4s’], u’segmentation_type’: None}}, u’time_series_length’: 4, u’data’: [{u’id’: u’ypf4s’, u’id_data’: [{u’metrics’: {u’video_views_100’: None, u’video_3s100pct_views’: None, u’likes’: [2, 8, 5, 1], u’replies’: None, u’tweets_send’: None, u’impressions’: [5090, 10444, 9815, 5256], u’url_clicks’: [4, 11, 6, 7], u’retweets’: [2, 0, 1, 0], u’video_total_views’: None, u’clicks’: [28, 47, 53, 25], u’video_cta_clicks’: None, u’video_views_50’: None, u’video_views_75’: None, u’card_engagements’: None, u’billed_engagements’: [4, 11, 6, 7], u’qualified_impressions’: None, u’engagements’: [43, 64, 66, 39], u’billed_charge_local_micro’: [11210000, 39530000, 30220000, 31560000], u’carousel_swipes’: None, u’video_mrc_views’: None, u’follows’: [1, 0, 0, 0], u’app_clicks’: None, u’video_content_starts’: None, u’video_views_25’: None}, u’segment’: None}]}], u’data_type’: u’stats’}

Here is the final job result:

{u’status’: u’SUCCESS’, u’created_at’: u’2016-10-03T19:00:55Z’, u’placement’: u’ALL_ON_TWITTER’, u’account_id’: u’18ce53uwc4a’, u’metric_groups’: [u’ENGAGEMENT’, u’BILLING’, u’VIDEO’], u’url’: u’’, u’country’: None, u’start_time’: u’2016-09-02T23:00:00Z’, u’expires_at’: u’2016-10-05T19:01:11Z’, u’entity’: u’PROMOTED_TWEET’, u’platform’: None, u’id_str’: u’783019014318587904’, u’granularity’: u’HOUR’, u’entity_ids’: [u’ypf4s’], u’segmentation_type’: None, u’id’: 783019014318587904L, u’end_time’: u’2016-09-03T03:00:00Z’}



Hey @stevea.jones,

Our twurl client is ruby based, however it is a command-line tool so no prior knowledge of Ruby is necessary. It seems that the SDK is working as expected, and the latency issues you’re seeing are related to our backend services. If you follow the link posted in the previous response, we’ve mentioned a few reasons why degradation may occur.


Just to post an update here as well - as I mentioned in Analytics Jobs Taking a Long Time to Complete we have identified some moderate degradation but do not expect it to last. I would expect the performance to improve soon but if it doesn’t please look out for more updates.