The official Python SDK for the X (formerly Twitter) API, currently at v0.9.0. Provides asynchronous and synchronous clients, OAuth 2.0 support, and wrappers for endpoints like tweets, users, media, and direct messages. Active development with monthly releases.
pip install xdkVerified import paths — ran on the pinned version, not inferred.
Initialize a synchronous client with OAuth 2.0 Bearer token and fetch the authenticated user's info.
Use `from xdk import XClient` instead.
Create an `OAuth2Bearer` object and pass it as `auth=OAuth2Bearer(token=...)`.
Ensure `httpx` is installed and do not force `use_requests=True`.
Always use `await client.some_method()` when using `AsyncXClient`.