skillfed

xclienttransaction

Twitter X-Client-Transaction-Id generator written in python.

xclienttransaction v1.0.3 243.0K downloads/30d#8,831 on PyPI265
Permissive license MIT Active released

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 xclienttransaction

uv

uv add xclienttransaction

poetry

poetry add xclienttransaction

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: End Users/DesktopLicense :: OSI Approved :: MIT LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: UnixProgramming Language :: Python :: 3Topic :: Software Development :: Build ToolsTopic :: Software Development :: Libraries :: Python Modules

Tags

twitter x client transaction idx.com api authentication headertwitter tid generatorx api client transactiontwitter api header generationx.com request authentication
twitter-apireverse-engineeringauthentication

More Python Modules packages