Python SDK


Is there a python library in the works for ads? I am familiar with tweepy and was wondering if there’s anything similar for ads API?


You’re probably aware that tweepy is a third-party library, although many of our team use it (and contribute to it sometimes!) :wink:

Nothing to announce on plans to release libraries on our side, but we’re always happy to see Open Source projects around our APIs and it sounds like Python is in demand in case any enterprising developers want to either add to tweepy, or come up with something specific to Ads…


Thanks Andy, just needed to make sure there wasn’t anything out there pre-built before I jumped down the python route myself.


@Ci_WebSummit while @andypiper’s statement for Twitter in general is definitely true, The Ads API team has been working on this and there actually will be an officially supported set of Twitter SDKs for the Ads API real soon.

We’re currently targeting Ruby, Python and Java for end of Q2. Later in Q3 we’ll be releasing Ads API SDKs for C# and Node JS as well. Stayed tuned here in the forums for announcements and access to pre-releases.


That would be fantastic help, do you have a planned release date?


We don’t have a date we’re communicating publicly yet beyond the Q2 time frame, but we’ll share it here in the forums as soon as we do. This thread is actually the first time we’ve shared the info broadly. You got the inside scoop :wink:


Great, please keep me in the loop :smiley:



@Ci_WebSummit here is my answer on quora that may help you out (I looked at tweepy source code and looks like it would be very similar to the twython snippet I have below)

You can use your favorite twitter rest api client, there is a long list on Twitter Libraries page.

The one that worked well for me, it uses requests & requests_oauth underneath which makes it really stable is Twython. To use it with ads api, go ahead and create a Twython client as per the docs and then proceed to use the low level request method with the full ads-api url. For example:

from twython import Twython
twitter = Twython(oauth_token=...)


@pykler thanks so much for the tip. I’ve developed the authorization process to work using requests and requests_oauthlib in python 3, which isn’t nearly as neat as using twython. The effort for creating campaigns etc seems to be similar whether you’re using it or not though