Skip to main content

Up-to-date simple user-agent faker with real world database

Project description

forge-useragent

Forked version of fake-useragent.

  • Supports Python 3.10 or higher

Introduction

Installation

# pypi name change to `forge-useragent`
pip install forge-useragent

# check version
pip list | grep -i forge-useragent
python -c "import fake_useragent; print(fake_useragent.__version__)"

Usage

package name is same fake_useragent:

from fake_useragent import UserAgent
ua = UserAgent()

# Get a random browser user-agent string
print(ua.random)

# Or get user-agent string from a specific browser
print(ua.chrome)
print(ua.firefox)
print(ua.safari)
print(ua.opera)
print(ua.edge)

print(ua['Chrome'])

More

# names are case-sensitive!
from fake_useragent import UserAgent

# browsers
ua = UserAgent(browsers=['Edge', 'Chrome'])
ua.random

# os
ua = UserAgent(os='Linux')
ua.random

# platforms: desktop / mobile / tablet
ua = UserAgent(platforms='mobile')
ua.random

from fake_useragent import UserAgent
ua = UserAgent(platforms='desktop')
ua.random

# get only user agents that have a minimum version of 120.0:
from fake_useragent import UserAgent
ua = UserAgent(min_version=120.0)
ua.random

User-agent Python Dictionary

Warning Raw JSON objects (in a Python dictionaries) are returned "as is". Meaning, this data structure could change in the future!

Be aware that these "get" properties below might not return the same key/value pairs in the future. Use ua.random or alike as mentioned above, if you want to use a stable interface.

INCOMPATIBLE PROPERTY NAME CHANGED!

from fake_useragent import UserAgent
ua = UserAgent()

# Random user-agent dictionary (object)
ua.get_random # old version: ua.getRandom

# More get properties:
ua.get_f_irefox # ua.getFirefox
ua.get_chrome   # ua.getChrome
ua.get_safari   # ua.getSafari
ua.get_edge     # ua.getEdge

# And a method with an argument.
ua.get_browser('firefox') # ua.getBrowser('firefox')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

forge_useragent-3.0.1.tar.gz (276.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

forge_useragent-3.0.1-py3-none-any.whl (277.3 kB view details)

Uploaded Python 3

File details

Details for the file forge_useragent-3.0.1.tar.gz.

File metadata

  • Download URL: forge_useragent-3.0.1.tar.gz
  • Upload date:
  • Size: 276.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for forge_useragent-3.0.1.tar.gz
Algorithm Hash digest
SHA256 5f8d38941126eeb22717d38a4bb0bcff66051ad232e8096f63a6f2415c1c0fca
MD5 bb7cc6303d026edaf1009ffeb504d49d
BLAKE2b-256 dca2a2e1574d2721ba1e33d4d24761172207db8ea0cab510fca1352ac80f76d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for forge_useragent-3.0.1.tar.gz:

Publisher: python-publish.yml on hantang/python-ua

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file forge_useragent-3.0.1-py3-none-any.whl.

File metadata

  • Download URL: forge_useragent-3.0.1-py3-none-any.whl
  • Upload date:
  • Size: 277.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for forge_useragent-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e7c814706e94129643d0c1159d6d244a6d2fa07ab9f37cb716cdceff581c9a31
MD5 9b5d4d797332007cb2a3d2b6b094704e
BLAKE2b-256 1cec0b3c9d0e3cd4f3e5cf174762428db0cd55acfe6e6211095b4d9dd8f41064

See more details on using hashes here.

Provenance

The following attestation bundles were made for forge_useragent-3.0.1-py3-none-any.whl:

Publisher: python-publish.yml on hantang/python-ua

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page