Skip to content

v1.1.0

Latest

Choose a tag to compare

@restocked restocked released this 08 Apr 15:17

What's New

Automatic Retry with Backoff

The SDK now automatically retries on transient errors with exponential backoff + jitter:

  • 429 (Rate Limit) — waits the retry_after duration from the API, then retries
  • 5xx (Server Error) — retries with exponential backoff
  • Network errors — retries on timeouts and connection failures
  • 4xx (Client Error) — never retried (fail immediately)

Fully configurable:

client = TweetAPI(
    api_key="YOUR_API_KEY",
    max_retries=5, initial_retry_delay=2.0, backoff_multiplier=3.0, max_retry_delay=60.0,
)

# Or disable entirely
client = TweetAPI(api_key="YOUR_API_KEY", max_retries=0)

Auto-Pagination Helpers

New paginate() and paginate_pages() generators — no more manual cursor loops:

from tweetapi import paginate

for user in paginate(
    lambda cursor: client.user.get_followers(user_id="123", cursor=cursor),
    max_pages=5,
):
    print(user["username"])

Works with any paginated endpoint — followers, tweets, search, lists, communities, etc.

Split Timeouts

Separate connect and read timeouts for finer control:

client = TweetAPI(api_key="YOUR_API_KEY", connect_timeout=5.0, read_timeout=30.0)
# Or as a tuple
client = TweetAPI(api_key="YOUR_API_KEY", timeout=(5, 30))

Typed Return Values

All 70+ resource methods now return specific TypedDicts instead of dict[str, Any], giving full IDE autocomplete on response data.

Rate Limit Awareness

  • 429 retry_after is respected automatically during retry
  • Last rate limit state exposed via client.rate_limit_info

New Exports

  • paginate, paginate_pages — pagination helper functions

Full Changelog

v1.0.0...v1.1.0