xclienttransaction
Twitter X-Client-Transaction-Id generator written in python.
What it is and what it does
XClientTransaction generates the X-Client-Transaction-ID header required to authenticate requests to X.com APIs. The package implements a reverse-engineered transaction ID generation algorithm and provides utilities to create valid transaction IDs for specific HTTP methods and API paths. It works by parsing the X.com home page and an ondemand.s file to extract cryptographic material, then uses that material to compute transaction IDs.
The package supports both synchronous and asynchronous workflows. It includes helper functions to fetch and parse necessary X.com responses, handle domain migration from twitter.com to x.com, and generate properly formatted headers. The single runtime dependency is beautifulsoup4 for HTML parsing, keeping the installation lightweight.
Use it for:
- Automating X.com API requests that require valid X-Client-Transaction-ID headers without using official SDK authentication.
- Building bots or scrapers that interact with X.com endpoints and need to satisfy transaction ID validation.
- Reverse-engineering or testing X.com's API authentication mechanisms in security research contexts.
- Integrating X.com API access into applications where standard OAuth flows are unavailable or impractical.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates X-Client-Transaction-ID headers for authenticating requests to X.com APIs by implementing the reverse-engineered transaction ID generation algorithm.
Yes, if you need to make authenticated requests to X.com APIs outside official SDK channels. The package is actively maintained, has low install friction, carries no known vulnerabilities, and uses a permissive MIT license. Be aware that reverse-engineered authentication mechanisms can break if X.com changes its algorithms.
Install
xclienttransaction on PyPI
pip
pip install xclienttransactionuv
uv add xclienttransactionpoetry
poetry add xclienttransactionInstalling xclienttransaction
Before you install
Low install friction with a single runtime dependency (beautifulsoup4). Actively maintained with recent commits; marked Production/Stable.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both commercial and personal projects.
Quickstart
pip install xclienttransaction
from xclienttransaction import ClientTransaction
from urllib.parse import urlparse
ct = ClientTransaction(home_page_response=home_page_response, ondemand_file_response=ondemand_file_response)
transaction_id = ct.generate_transaction_id(method='POST', path='/i/api/1.1/jot/client_event.json')
Requires fetching X.com home page and ondemand.s file responses first to initialize ClientTransaction; these responses must be parsed and passed to the constructor.
Verify before relying
- Whether the reverse-engineered algorithm remains stable as X.com updates its authentication mechanisms.
- Performance characteristics when generating transaction IDs at scale or high frequency.
- Compatibility with different X.com API versions and endpoints beyond those shown in examples.
- Whether use of this package complies with X.com's terms of service.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — beautifulsoup4 |
| Maintenance | actively maintained — 49 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 242,990/month — #8,831 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: xclienttransaction-1.0.3-py3-none-any.whl
Keywords: XClientTransaction, twitter transaction id, client transaction id twitter, tid generator, x client transaction id generator, xid twitter, tweeterpy
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
ScweetScrape tweets, profiles, followers, and user…
permissive · top 15,000 on PyPI
twscrapetwscrape is an async Python library and CLI for…
permissive · top 15,000 on PyPI
edgegrid-pythonProvides an authentication handler for HTTP…
permissive · top 5,000 on PyPI
rauthRauth provides OAuth 1.0/a and OAuth 2.0…
permissive · top 5,000 on PyPI
tweepyTweepy is a Python library that provides access…
permissive · top 5,000 on PyPI
django-xffDjango middleware that extracts the real client…
permissive · top 15,000 on PyPI
requests-oauthAdds OAuth 1.0 authentication support to the…
permissive · top 5,000 on PyPI
wafer-pyAn anti-detection HTTP client that handles TLS…
permissive · top 15,000 on PyPI
eth-accounteth-account signs Ethereum transactions and…
permissive · top 5,000 on PyPI
www-authenticateParses WWW-Authenticate HTTP headers into…
permissive · top 15,000 on PyPI