freshcrate
Skin:/
Home > Databases > fake-useragent

fake-useragent

Up-to-date simple useragent faker with real world database

Why this rank:Strong adoptionRelease freshnessHealthy release cadence

Description

[![Test & Deploy fake-useragent](https://github.com/fake-useragent/fake-useragent/actions/workflows/action.yml/badge.svg?branch=main)](https://github.com/fake-useragent/fake-useragent/actions/workflows/action.yml?query=branch%3Amain) [![Ruff linter](https://github.com/fake-useragent/fake-useragent/actions/workflows/ruff.yml/badge.svg?branch=main)](https://github.com/fake-useragent/fake-useragent/actions/workflows/ruff.yml?query=branch%3Amain) [![CodeQL](https://github.com/fake-useragent/fake-useragent/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/fake-useragent/fake-useragent/actions/workflows/codeql.yml?query=branch%3Amain) # fake-useragent Up-to-date simple useragent faker with real world database. ## Features - Data is pre-downloaded & post-processed from [Intoli LLC](https://github.com/intoli/user-agents/tree/main/src) and the data is part of the package itself - The data consists of a wide range of browser agents and various browsers - Retrieves user-agent strings (both of type: `desktop`, `tablet` and/or `mobile` UAs) - Retrieve user-agent Python dictionary (aka object), with fields like `useragent`, `percent`, `type`, `device_brand`, `browser`, `browser_version`, `os`, `os_version` and `platform` - Supports Python 3.x ### Installation ```sh pip install fake-useragent ``` Or if you have multiple Python / pip versions installed, use `pip3`: ```sh pip3 install fake-useragent ``` ### Usage Simple usage examples below, see also next chapters in this readme for more advanced usages: ```py from fake_useragent import UserAgent ua = UserAgent() # Get a random browser user-agent string print(ua.random) # Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0 # Or get user-agent string from a specific browser print(ua.chrome) # Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 print(ua.google) # Mozilla/5.0 (iPhone; CPU iPhone OS 18_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) GSA/343.0.695551749 Mobile/15E148 Safari/604.1 print(ua['Chrome']) # Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 print(ua.firefox) # Mozilla/5.0 (Android 14; Mobile; rv:133.0) Gecko/133.0 Firefox/133.0 print(ua.ff) # Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0 print(ua.safari) # Mozilla/5.0 (iPhone; CPU iPhone OS 17_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.6 Mobile/15E148 Safari/604.1 Ddg/17.6 print(ua.opera) # Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 OPR/114.0.0.0 print(ua.edge) # Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0 ``` #### Additional usage Additional features that fake-useragent now offers since v1.2.0. If you want to specify your own browser list, you can do that via the `browsers` argument (default is: `["Google", "Chrome", "Firefox", "Edge", "Opera", "Safari", "Android", "Yandex Browser", "Samsung Internet", "Opera Mobile", "Mobile Safari", "Firefox Mobile", "Firefox iOS", "Chrome Mobile", "Chrome Mobile iOS", "Mobile Safari UI/WKWebView", "Edge Mobile", "DuckDuckGo Mobile", "MiuiBrowser", "Whale", "Twitter", "Facebook", "Amazon Silk"]`). This example will only return random user-agents from Edge and Chrome: ```py from fake_useragent import UserAgent ua = UserAgent(browsers=['Edge', 'Chrome']) ua.random ``` _Note:_ Fakeuser-agent knowns about browsers: Chrome, Edge, Firefox, Safari, Opera, Android, Opera Mobile, Mobile Safari, Firefox Mobile, Firefox iOS, Chrome Mobile, Chrome Mobile iOS and more (see again full list above). _Note #2:_ Since fakeuser-agent v2.0.0 the browser names are case-sensitive! --- If you want to specify your own operating systems, you can do that via the `os` argument (default is: `["Windows", "Linux", "Ubuntu", "Chrome OS", "Mac OS X", "Android", "iOS"]`). In this example you will only get Linux user-agents back: ```py from fake_useragent import UserAgent ua = UserAgent(os='Linux') ua.random ``` _Note:_ Since fakeuser-agent v2.0.0 the OS names are case-sensitive! --- You can also specify the type of platforms you want to use, you can do that via the `platforms` argument (default is `["desktop", "mobile", "tablet"]`). This example will only return random user-agents from a mobile device: ```py from fake_useragent import UserAgent ua = UserAgent(platforms='mobile') ua.random ``` And a random user-agent from a desktop device: ```py from fake_useragent import UserAgent ua = UserAgent(platforms='desktop') ua.random ``` --- If you want to return more recent user-agent strings, you can play with the `min_version` argument (default is: `0.0`, meaning all user agents will match). In this example you get only user agents that have a minimum version of 120.0: ```py from

Release History

VersionChangesUrgencyDate
2.2.0Imported from PyPI (2.2.0)Low4/21/2026
2.1.0## What's Changed * Update README.md by @matecsaj in https://github.com/fake-useragent/fake-useragent/pull/415 * Refactor UA updater CLI and add GH action to run updates automatically by @sebastian-correa in https://github.com/fake-useragent/fake-useragent/pull/404 * Trigger only once per month by @melroy89 in https://github.com/fake-useragent/fake-useragent/pull/422 * Speedup `ua_convert` parser by @sebastian-correa in https://github.com/fake-useragent/fake-useragent/pull/424 * Bump ruff fLow3/12/2025
2.0.3- Fix `importlib-resources` in `dependencies` toml file. **See the `2.0.0` release below [for all the changes that are in v2.0.0](https://github.com/fake-useragent/fake-useragent/releases/tag/2.0.0)!!** **Full Changelog**: https://github.com/fake-useragent/fake-useragent/compare/2.0.2...2.0.3Low12/10/2024
2.0.2Sync latest docs to PyPi. **See the `2.0.0` release below [for all the changes that are in v2.0.0](https://github.com/fake-useragent/fake-useragent/releases/tag/2.0.0)!!** **Full Changelog**: https://github.com/fake-useragent/fake-useragent/compare/2.0.1...2.0.2Low12/9/2024
2.0.1Small patch release after v2.0.0, by adding a requires-python line to the toml file. We only support Python 3.9 or newer. ## What's Changed * Bump validate-pyproject from 0.22 to 0.23 by @dependabot in https://github.com/fake-useragent/fake-useragent/pull/393 * Bump coverage from 7.6.4 to 7.6.8 by @dependabot in https://github.com/fake-useragent/fake-useragent/pull/398 * Bump ruff from 0.7.3 to 0.8.1 by @dependabot in https://github.com/fake-useragent/fake-useragent/pull/403 * Bump tomli Low12/7/2024
2.0.0# fake-useragent v2.0.0 Finally, we successfully switched (again) to a new data source from [Intoli](https://intoli.com/), which allows us to have much more user-agent strings again. Thank you all for your support! **Important:** Keep in mind that v2.0.0 does have some breaking changes like `platform` type "pc" value is now changed to "desktop" (in case you were using this). See below for all breaking changes! ## Breaking changes - OS and browser options are now case sensitive!! - Low12/4/2024
1.5.1**Fix:** Remove trailing spaces in user agent strings ## What's Changed * Bump pytest from 7.4.3 to 8.1.1 by @dependabot in https://github.com/fake-useragent/fake-useragent/pull/306 * Bump lxml from 4.9.3 to 5.1.0 by @dependabot in https://github.com/fake-useragent/fake-useragent/pull/305 * Bump virtualenv from 20.25.0 to 20.25.1 by @dependabot in https://github.com/fake-useragent/fake-useragent/pull/303 * Bump ruff from 0.2.1 to 0.3.2 by @dependabot in https://github.com/fake-useragent/fLow3/16/2024
1.5.0Most important change: The user-agent database has been updated with a more recent list of user agents. It also now comes with mobile UA's, meaning a new parameter: `platforms` has been introduced (see [README.md](https://github.com/fake-useragent/fake-useragent/blob/main/README.md)). The only down-side is that this new data source didn't contain any usage data, meaning `min_percentage` is not useful anymore. Despite which `min_percentage` value you set, fake-useragent always return all dataLow3/8/2024
1.4.0## What's Changed * Bump urllib3 from 2.0.4 to 2.0.6 in /cache_scraper by @dependabot in https://github.com/fake-useragent/fake-useragent/pull/217 * Bump tzlocal from 5.0.1 to 5.1 by @dependabot in https://github.com/fake-useragent/fake-useragent/pull/218 * Bump build from 0.10.0 to 1.0.3 by @dependabot in https://github.com/fake-useragent/fake-useragent/pull/221 * Bump tldextract from 3.4.4 to 3.6.0 by @dependabot in https://github.com/fake-useragent/fake-useragent/pull/220 * Bump cffi froLow11/24/2023
1.3.0 - Introducing new `ua.getRandom`, `ua.getFirefox`, `ua.getChrome`, `ua.getSafari`. And a generic method: `ua.getBrowser(..)` (eg. `getBrowser('firefox')`) - These new properties above allows you to retrieve the whole raw Python dictionary, instead of only the UA string. - These properties might return different key/values pairs in the future! So `ua.random` is a more stable interface. - Fix the `os` argument 'windows' to check for both `win10`and `win7` values (previously only cheLow10/2/2023
1.2.1- Still using the new dataset of course! - Small improvements in the min_percentage check - Update all Pip package dependencies _Note:_ Parameter `use_external_data=True` and `verify_ssl` are **removed**. If you use those parameters, just remove it in your code! Low8/2/2023
1.2.0- Updated browser useragent data 🚀 - Allow filters on browser, OS and usage percentage 🚀 - Update the cache scraper to scape the new data source for user-agent strings - Adapted the code to work with the new JSON data format - Parameter `use_external_data=True` and `verify_ssl` are **removed**. If you use those parameters, just remove it in your code!Low8/2/2023
1.1.3- Update deps Low3/20/2023
1.1.2- Security release update Low2/8/2023
1.1.1- Remove white spaces from user agent strings, this is a patch release Low12/4/2022
1.1.0- Add `pkg_resource` as fallback mechanism in trying to retrieve the local JSON data fileLow11/26/2022
1.0.1Bug fix release. - Add `importlib-metadata` & `importlib-resources` as dependencies - Check on specific Python version regarding the importlib resources (python v3.10 or higher) in order to have `files()` working - `importlib_metadata` should now also work on Python version before 3.8 - Remove obsolete `MANIFEST.in` fileLow11/19/2022
1.0.0Finally, a major release! Version 1.0.0 stable. I hope you like it. - Make the JSON Lines data file part of the Python package, data is retrieved locally - Extend the `myproject.toml` file with `package-data` support - Remove centralized caching server implementation - Make real unit-tests which should run reliable, fast, independent and without Internet connection Low11/18/2022
0.1.14**Changes:** - Improve code quality standards using modern Python >=3.7 syntax - Migrated to `pyproject.toml` build system format + syntax check - Add additional classifiers to the toml file - Improved `tox.ini` file - Improved GitHub Actions job using pip cache - And various small fixesLow11/5/2022
0.1.13We have now a separate [GitHub Organization](https://github.com/fake-useragent) for hosting the `fake-useragent` repo. Changes in 0.1.13: - Implement `browsers` argument, allowing you to override the browser names you want to use - Fix browser listing of Internet Explorer and Edge - Don't depend on w3schools.com anymore - Clean-up data (temp) file format - Update fallback cache server URL / use JSON Lines as file format - Move to GitHub Actions instead of Travis - DeploLow11/3/2022

Dependencies & License Audit

Loading dependencies...

Similar Packages

alibabacloud-adb20211201Alibaba Cloud adb (20211201) SDK Library for Pythonmaster@2026-07-25
AIMAXXINGYour Very Own Agent: The Ultimate, Complete Editionmain@2026-07-24
sentence-transformersEmbeddings, Retrieval, and Rerankingv5.6.1
dbt-extractorA tool to analyze and extract information from Jinja used in dbt projects.main@2026-07-23
OpenVikingOpenViking is an open-source context database designed specifically for AI Agents(such as openclaw). OpenViking unifies the management of context (memory, resources, and skills) that Agents need throuv0.4.11

More from pypi

markitdownUtility tool for converting various files to Markdown
fastapiFastAPI framework, high performance, easy to learn, fast to code, ready for production
djangoA high-level Python web framework that encourages rapid development and clean, pragmatic design.
flaskA simple framework for building complex web applications.

More in Databases

alibabacloud-adb20211201Alibaba Cloud adb (20211201) SDK Library for Python
milvusMilvus is a high-performance, cloud-native vector database built for scalable vector ANN search
onyxOpen Source AI Platform - AI Chat with advanced features that works with every LLM
sentence-transformersEmbeddings, Retrieval, and Reranking