Skip to content

Release Notes

Shohei Maeda edited this page Aug 20, 2019 · 7 revisions

v5.3.0

New

Native support for rate-limit handling and request retry

PR: #213

We're excited to announce that the Ads API Python SDK now supports rate-limit handling & request retry for the first time ever!:tada:
You can enable and try it out by setting following options:

client = Client(
    CONSUMER_KEY,
    CONSUMER_SECRET,
    ACCESS_TOKEN,
    ACCESS_TOKEN_SECRET,
    options={
        'handle_rate_limit': True,
        'retry_max': 3,
        'retry_delay': 5000,
        'retry_on_status': [404, 500, 503]
    })
parameter default description
handle_rate_limit False (boolean) Set True will check rate-limit response header and sleep if the request reached the limit (429).
retry_max 0 (int) The number of times you want to retry when response code is found in retry_on_status.
retry_delay 1500 (int) The number of milliseconds you want to sleep before retry.
retry_on_status [500, 503] (list) The response codes you want to retry on. You can only set >= 400 status codes.

Changed

Use PromotedTweet.attach() instead of PromotedTweet.save()

PR: #212

# return Cursor object
response = PromotedTweet.attach(
    account,
    line_item_id='aaaa',
    tweet_ids=['111111111111111111', '222222222222222222' ... ]
)

Clone this wiki locally