fake-useragent

Up-to-date user-agent string faker backed by a real-world browser usage database, bundled offline.

Library
PyPI
v2.2.0
4,048 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
49 /100 Fair
Development Activity 4
Maintenance 20
Community 72
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
68 /100 Good
Architecture 62
Code Quality 68
Innovation 55
Learning Curve 85

fake-useragent generates realistic browser user-agent strings drawn from a periodically refreshed, real-world usage database (sourced from user-agents.net and processed via Intoli’s dataset) that ships bundled inside the package itself, so lookups work fully offline with no network calls at runtime. Callers can pull a random user agent across all browsers/platforms, restrict to specific browsers (Chrome, Firefox, Safari, Edge, Opera, and their mobile variants) or operating systems, and filter by minimum browser version.

It’s commonly reached for by scraping scripts, HTTP clients, and test suites that need to vary or spoof the User-Agent header rather than send a single hardcoded string that’s easy to fingerprint and block.

What You Get

  • UserAgent() object with per-browser attributes (.chrome, .firefox, .safari, .edge, .opera, .random, and more)
  • Dict-style ua['Chrome'] access alongside the attribute API
  • browsers, os, platforms, and min_version constructor filters to narrow the returned pool
  • getRandom/getBrowser(name)-style accessors returning the full UA metadata dict (percent, device, os, browser version)
  • Configurable fallback string returned if a lookup fails, plus safe_attrs to avoid attribute-access collisions
  • Bundled, pre-downloaded user-agent database — no network access needed at runtime

Common Use Cases

  • Rotating the User-Agent header sent by a web scraper to reduce fingerprinting/blocking
  • Generating realistic-looking synthetic traffic for load or integration testing
  • Feeding varied user-agent strings into browser-automation or crawler test fixtures
  • Simulating requests from specific browser/OS/device combinations during QA

Under The Hood

Architecture: The package is intentionally small — src/fake_useragent/fake.py implements the UserAgent class, which loads a bundled JSONL data file (src/fake_useragent/data/) at init time via utils.py’s loader, builds an in-memory pool filtered by the constructor’s browsers/os/platforms/min_version arguments, and exposes both attribute-style (__getattr__) and dict-style (__getitem__) access over that pool; errors.py defines the FakeUserAgentError raised (and caught into fallback) on lookup misses. Tech Stack: Pure Python 3.9+, zero runtime dependencies — the entire UA corpus is vendored as a JSONL file inside the package rather than fetched at runtime, which is what lets it work offline; pyproject.toml declares the data file as package data per setuptools’ data-files convention. Code Quality: A compact ~500-line src/ tree, tested via tox, linted with ruff and formatted with black, plus CodeQL security scanning wired into GitHub Actions — modest in scope but consistently maintained per its changelog, which documents a data-source migration (v1.5.0, v2.0.0) and dropped/added Python version support across releases. API Design: The dual attribute/dict access pattern (ua.chrome and ua['Chrome']) plus a permissive fallback default make the common case a one-liner (UserAgent().random), while getBrowser()/getRandom progressively expose the richer per-entry metadata dict for callers that need more than just the string.

Used by 5 apps in this directory

Python
97%
MIT

auto-news

AI Assistants · Productivity

908

An AI-powered personal news aggregator that filters multi-source feeds through LLMs and delivers curated, noise-free summaries to your Notion workspace.

View details
43
Repo Health
53
Technical
66
Dependency
Built with
Python 97%
Updated 1 years ago
Python
69%
MIT

Langflow

AI Agents · AI Development

155,319

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

View details
90
Repo Health
85
Technical
65
Dependency
Built with
Python 69%
TypeScript 22%
Updated 4 days ago
Python
37%
Other

Open WebUI

AI Agents · AI Assistants

153,390

The extensible, privacy-first AI platform that runs Ollama, OpenAI, and any LLM backend behind a polished, feature-packed web interface.

View details
91
Repo Health
75
Technical
66
Dependency
Built with
Python 37%
Svelte 34%
JavaScript 21%
Updated 4 days ago
Python
67%
Apache 2.0

SurfSense

AI Assistants · Search

16,270

The open-source, unlimited NotebookLM alternative with real-time collaboration, a desktop app, and no vendor lock-in.

View details
87
Repo Health
71
Technical
66
Dependency
Built with
Python 67%
TypeScript 30%
Updated 6 days ago
C++
75%
Apache 2.0

Timeplus Proton

Analytics · Data Engineering

2,262

Single C++ binary SQL engine for real-time stream processing, ETL, and analytics on Kafka, Redpanda, and ClickHouse with sub-millisecond latency.

View details
88
Repo Health
82
Technical
68
Dependency
Built with
C++ 75%
Python 11%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers