skillfed

user-agent

Library to build content for User-Agent HTTP header

user-agent v0.1.14 315.9K downloads/30d#7,683 on PyPI347
Permissive 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) AGING released

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-agent

uv

uv add user-agent

poetry

poetry add user-agent

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.0Programming Language :: Python :: 3.1Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.2Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Internet :: WWW/HTTPTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

random user agent generatoruser agent string generationbrowser user agent fakerweb scraping user agenthttp header user agentnavigator object generatorfake browser agent
web-scrapingtestinguser-agent

More Python Modules packages

Further reading