user-agent
Library to build content for User-Agent HTTP header
What it is and what it does
user_agent is a library for generating realistic, randomized user agent strings and navigator object properties. It produces valid HTTP User-Agent header content and JavaScript navigator object data across a range of browsers and operating systems. The package exposes functions like generate_user_agent() and generate_navigator() that return either raw strings or structured dictionaries, and includes a command-line tool (ua) for one-off generation.
The library is commonly used in web scraping, web crawling, and testing scenarios where rotating or spoofing user agents helps avoid detection or simulate diverse client environments. It depends on six and pytz for Python 2/3 compatibility and timezone handling. The package supports Python 2.7 through 3.13, though its aging maintenance status means the underlying user agent database may lag behind the latest browser releases.
Use it for:
- Rotate user agents in web scrapers to avoid bot detection and IP blocking
- Generate realistic navigator objects for browser automation and headless testing
- Simulate diverse client environments in load testing and stress testing scenarios
- Populate User-Agent headers in HTTP requests for web crawlers and API clients
- Test web applications' handling of different browsers and operating systems
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates random, valid web user agent strings for HTTP headers and browser navigator objects across multiple operating systems and browsers.
Yes, if you need basic user agent generation for web scraping or testing. The low install friction, permissive MIT license, and broad Python version support make it straightforward to add. However, be aware that maintenance is aging (338 days since last release) and the user agent database may not reflect the latest browser versions—verify that generated agents match your target environment before relying on it for production bot detection evasion.
Install
user-agent on PyPI
pip
pip install user-agentuv
uv add user-agentpoetry
poetry add user-agentInstalling user-agent
Before you install
Low install friction with only two lightweight runtime dependencies (six and pytz). Maintenance status is aging—last release was 338 days ago—but the repository remains active with recent commits and no archived status.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal obligations, making it suitable for both open-source and commercial projects.
Quickstart
pip install user-agent
from user_agent import generate_user_agent, generate_navigator
generate_user_agent()
# 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.3; Win64; x64)'
generate_navigator()
Verify before relying
- Whether the generated user agents remain current with modern browser versions and OS releases
- How frequently the user agent database is updated to reflect real-world browser landscape changes
Package facts
| License | The MIT License (MIT) Copyright (c) 2015-2025, Gregory Petukhov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=2.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — six, pytz |
| Maintenance | aging — 338 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 315,880/month — #7,683 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: user_agent-0.1.14-py2.py3-none-any.whl
Keywords: user agent, browser, web crawling, web scraping, web crawler, web scraper
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
fake-headersGenerates realistic User-Agent strings and HTTP…
permissive · top 15,000 on PyPI
latest-user-agentsFetches and provides current user agent strings…
permissive · top 15,000 on PyPI
random-user-agentProvides random user agent strings filtered by…
permissive · top 15,000 on PyPI
fake-useragentGenerates random or browser-specific user-agent…
permissive · top 5,000 on PyPI
wootheeWoothee parses user-agent strings to identify…
permissive · top 15,000 on PyPI
ua-generatorGenerates realistic, randomized user-agent…
permissive · top 5,000 on PyPI
fake-http-headerGenerates realistic-looking HTTP request…
permissive · top 15,000 on PyPI
ua-parserParses user-agent strings to extract browser,…
permissive · top 1,000 on PyPI
browserforgeGenerates realistic browser headers and device…
permissive · top 5,000 on PyPI
httpagentparserParses HTTP User-Agent strings to extract and…
unclear · top 15,000 on PyPI