Skip to main content

UAForge

Enterprise-grade, deterministic User Agent & Client Hint generator based on real-world browser statistics

Python Version License Auto-Updated


Most "random user-agent" libraries are broken. They generate outdated browser strings, mix incompatible OS combinations, or lack the modern headers that fingerprinting systems now check.

UAForge takes a different approach. Instead of picking random strings, it simulates real users based on statistical probability. If Chrome 143 on Android holds 40% global market share, UAForge generates that identity 40% of the time.

It also generates matching Client Hints (Sec-CH-UA) headers automatically—allowing your automation to pass modern fingerprinting checks that go beyond the legacy User-Agent string.

Key Features

  • Statistically Accurate — Weighted by real-world global usage data, updated weekly from caniuse.com
  • Smart Correlations — Enforces valid browser↔OS mappings (no Safari on Windows)
  • Real Hardware — Injects actual device models (Pixel 9, Galaxy S24, etc.) for mobile agents
  • Client Hints — Generates Sec-CH-UA, Sec-CH-UA-Mobile, Sec-CH-UA-Platform, and GREASE tokens
  • Deterministic — Seed support for consistent, reproducible identities across sessions

Installation

pip install git+https://github.com/sarperavci/uaforge.git

Note: The repo does not contain the market-share data files due to size constraints. They are automatically downloaded from the release assets while installing.

Quick Start

The API is designed to be simple. You generate an "Identity" object, which contains everything you need for your requests.

from uaforge.core.generator import UserAgentGenerator

# 1. Initialize the generator
agent = UserAgentGenerator()

# 2. Generate an identity
identity = agent.generate()

# 3. Get the headers (includes User-Agent AND Client Hints)
headers = identity.get_headers()
full_client_hints = identity.get_all_client_hints()

# Use with requests/httpx
# response = requests.get("https://httpbin.org/headers", headers=headers)

print(f"Browser: {identity.meta_browser.value}")
print(f"OS:      {identity.meta_os.value}")
print(headers)
print(full_client_hints)

Sample Output

Default Headers:

{
"User-Agent": "Mozilla/5.0 (Linux; Android 13; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Mobile Safari/537.36",
"Sec-CH-UA": "\"Not A Brand\";v=\"99\", \"Chromium\";v=\"144\", \"Google Chrome\";v=\"144\"",
"Sec-CH-UA-Mobile": "?1",
"Sec-CH-UA-Platform": "\"Android\""
}

Full Client Hints:

{
"Sec-CH-UA": "\"Not A Brand\";v=\"99\", \"Chromium\";v=\"144\", \"Google Chrome\";v=\"144\"",
"Sec-CH-UA-Mobile": "?1",
"Sec-CH-UA-Platform": "\"Android\"",
"Sec-CH-UA-Full-Version-List": "\"Not A Brand\";v=\"99.0.0.0\", \"Chromium\";v=\"144.0.7559.59\", \"Google Chrome\";v=\"144.0.7559.59\"",
"Sec-CH-UA-Platform-Version": "13.0.0",
"Sec-CH-UA-Model": "\"Pixel 9\"",
"Sec-CH-UA-Arch": "\"arm\"",
"Sec-CH-UA-Bitness": "\"64\"",
"Sec-CH-UA-Full-Version": "\"144.0.7559.59\"",
"Sec-CH-UA-Form-Factors": "\"Mobile\"",
"Sec-CH-UA-WoW64": "?0",
"Sec-CH-Prefers-Color-Scheme": "dark"
}

Advanced Usage

Deterministic Generation (Sessions)

If you are managing long-running sessions, you need the User Agent to stay consistent across restarts. Use a seed.

# The identity generated here will ALWAYS be the same for seed 42
user = UserAgentGenerator(seed=42).generate()

print(user.user_agent) 
# Useful for associating a UA with a specific database UserID

Accessing Granular Data

Sometimes you need just the OS version or just the device model for analytics.

identity = agent.generate()

if identity.meta_device == "mobile":
    print(f"Device Model: {identity.ch_model}")  # e.g. "Pixel 8 Pro"
    print(f"Architecture: {identity.ch_arch}")   # e.g. "arm"

How it works

The Data Sources

We don't guess. We utilize three distinct data layers:

  1. market_share.json: Global browser usage stats (Chrome, Safari, Edge, Firefox).
  2. os_distribution.json: The probability of an OS given a specific browser (e.g., Safari is 100% macOS/iOS, but Chrome is split between Windows, Mac, Linux, and Android).
  3. device_models.json: A curated list of ~500 real-world mobile device fingerprints.

Maintenance & Updates

The browser ecosystem moves fast. Market share data is automatically updated weekly via GitHub Actions by parsing the latest data from caniuse.com.

You can also trigger a manual update by running:

python scripts/parse_caniuse.py

Current Market Share Distribution

The table below shows the aggregated browser market share from the current dataset. Data is sourced from caniuse.com and updated automatically.

Browser Market Share
Chrome for Android 56.17%
Chrome (Desktop) 19.11%
iOS Safari 12.32%
Edge 4.66%
Safari (Desktop) 2.17%
Firefox 1.73%
Samsung Internet 1.65%
Opera Mobile 0.74%
Opera 0.50%
UC Browser 0.42%
Firefox for Android 0.36%
IE 0.18%

Last updated: 21-10-2026

License

MIT License. Feel free to use this in your commercial scrapers, bots or testing suites.

Metadata

Release files for uaforger 0.1.24

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for uaforger 0.1.24
File Size Uploaded Provenance Actions
uaforger-0.1.24.tar.gz 68.7 kB Without provenance Details for uaforger-0.1.24.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for uaforger 0.1.24
File Interpreter ABI Platform Actions
uaforger-0.1.24-py3-none-any.whl Python 3 none any Details for uaforger-0.1.24-py3-none-any.whl

Total release size: 140.6 kB

Release files / uaforger-0.1.24.tar.gz

Download URL uaforger-0.1.24.tar.gz
Size 68.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f9af445e4dd3317926c8f25492e3d8b3aa880de0a68d100c22bbe4af74982a81
BLAKE2b-256 checksum
How to use checksums
b24ae31c1e2fd9497f6bc110c404b3f735e13c3ea082f2a039f62bbca4b263a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Release files / uaforger-0.1.24-py3-none-any.whl

Download URL uaforger-0.1.24-py3-none-any.whl
Size 71.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ba74cb763589d7b83e4c080b2f49c6c1b8e555cb3a4215b468c906d3867b2c0
BLAKE2b-256 checksum
How to use checksums
0b7414a1e558805ad3e26878d68fed1c466bdcd543887bda4e6fb46ac9730861
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Security for uaforger 0.1.24

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page