ua-generator
A random user-agent generator
What it is and what it does
ua-generator creates randomized user-agent strings that mimic real browsers and devices without relying on external data sources or downloads. The package hardcodes browser and platform versions based on actual releases, allowing you to generate strings for specific combinations of device type (desktop/mobile), platform (Windows, macOS, iOS, Linux, Android), and browser (Chrome, Edge, Firefox, Safari). It also generates corresponding Client Hints headers (Sec-CH-UA fields) that match the user-agent, making it suitable for integration with HTTP libraries like requests, httpx, urllib, and Selenium.
The package has no runtime dependencies and requires only Python 3.9 or later. You can customize generation with options like weighted version selection (favoring newer versions), version ranges, and latest-version-only filtering. The generated output includes the user-agent string itself, parsed metadata (platform, browser), and a headers helper that constructs a complete dictionary of HTTP headers ready to pass to requests or other HTTP clients.
Use it for:
- Rotate realistic user-agents in web scrapers to avoid detection and blocking
- Test HTTP client libraries and servers with varied user-agent strings and Client Hints
- Integrate randomized user-agents into Selenium automation to mimic real browser behavior
- Generate matching user-agent and Sec-CH-UA headers for modern web requests
- Populate test fixtures with realistic browser/platform combinations
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates realistic, randomized user-agent strings for modern browsers and platforms without external dependencies or downloads.
Yes. The package is lightweight, dependency-free, actively maintained, and solves a common need in web automation and testing. It covers modern browsers and platforms with hardcoded versions and includes Client Hints support. The recent release cycle and zero vulnerabilities make it a low-risk choice.
Install
ua-generator on PyPI
pip
pip install ua-generatoruv
uv add ua-generatorpoetry
poetry add ua-generatorInstalling ua-generator
Before you install
Installs cleanly with no runtime dependencies. Actively maintained with a recent release (12 days old) and steady repository activity.
License in practice
Licensed under Apache Software License (permissive), allowing use in commercial and private projects without significant restriction.
Quickstart
pip install ua-generator
import ua_generator
ua = ua_generator.generate()
print(ua.text) # Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) ...
print(ua.headers.get()) # Dict with user-agent and Sec-CH-UA headers
Requires Python >= 3.9
Verify before relying
- Whether hardcoded user-agent versions remain current between releases without automatic updates
- Performance characteristics when generating large batches of user-agents
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 12 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 952,670/month — #4,652 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ua_generator-2.1.3-py3-none-any.whl
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
fake-useragentGenerates random or browser-specific user-agent…
permissive · top 5,000 on PyPI
ua-parserParses user-agent strings to extract browser,…
permissive · top 1,000 on PyPI
fake-headersGenerates realistic User-Agent strings and HTTP…
permissive · top 15,000 on PyPI
user-agentGenerates random, valid web user agent strings…
permissive · top 15,000 on PyPI
latest-user-agentsFetches and provides current user agent strings…
permissive · top 15,000 on PyPI
ua-parser-rsProvides a Rust-accelerated user-agent parser…
permissive · top 5,000 on PyPI
random-user-agentProvides random user agent strings filtered by…
permissive · top 15,000 on PyPI
device-detectorParses user agent strings and client hints to…
unclear · top 15,000 on PyPI
fake-http-headerGenerates realistic-looking HTTP request…
permissive · top 15,000 on PyPI
browserforgeGenerates realistic browser headers and device…
permissive · top 5,000 on PyPI