Skip to main content

anti-useragent

info: fake pc or app browser useragent, anti useragent, and other awesome tools

Features

  • more browser up to date
  • more randomize ruler
  • more fun awesome tools

English | 中文

Installation

pip install anti-useragent

Usage

from anti_useragent import UserAgent
ua = UserAgent()

ua.opera
# Opera/9.80 (X11; Linux i686; U; ru) Presto/2.8.131 Version/11.11
ua.chrome
# Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36
ua['chrome']
# Mozilla/5.0 (Windows NT 5.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.2.3576.5 Safari/537.36
ua.firefox
# Mozilla/5.0 (Windows NT 5.1; WOW64; rv:47.0) Gecko/20100101 Firefox/45.0
ua['firefox']
# Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:49.0) Gecko/20100101 Firefox/31.0
ua.android
# Mozilla/5.0 (Linux; Android 7.5.2; M571C Build/LMY47D) AppleWebKit/666.7 (KHTML, like Gecko) Chrome/72.7.7953.78 Mobile Safari/666.7
ua.iphone
# Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_1 like Mac OS X) AppleWebKit/349.56 (KHTML, like Gecko) Mobile/J9UMJN baiduboxapp/0_17.7.6.6_enohpi_8957_628/2.01_4C2%258enohPi/1099a/P0SJ2RX4DXJT3RW906040KVOSH2E76RJUNHVIJUPCJQCZMEM2GL/1
ua.wechat
# Mozilla/5.0 (Linux; Android 10.9.8; MI 5 Build/NRD90M) AppleWebKit/536.93 (KHTML, like Gecko) Chrome/81.7.8549.56 Mobile Safari/536.93

# and the best one, random via real world browser usage statistic
ua.random
# Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.3.8610.5 Safari/537.36

Supported platform

browser/platfom windows mac linux iphone android
chrome ✔ ✔ ✔ ✔ ✔
firefox ✔ ✔ ✔ ❌ ❌
opera ✔ ✔ ✔ ❌ ❌
wechat ❌ ❌ ❌ ✔ ✔
baidu ❌ ❌ ❌ ✔ ✔
uc ❌ ❌ ❌ ❌ ✔

If You want to specify the platform just:

from anti_useragent import UserAgent
ua = UserAgent(platform='mac') # windows, linux, android, iphone

If You want to specify the browser max version or min version just:

from anti_useragent import UserAgent
ua = UserAgent(max_version=90)

ua = UserAgent(min_version=50)

# 1.0.9 new supported
ua = UserAgent(versions=(90, 100))

If You want to specify the enable logger just:

from anti_useragent import UserAgent
ua = UserAgent(logger=True)

# the default install loguru
try:
    from loguru import logger
except:
    install("loguru")
    from loguru import logger

Make sure that You using latest version

pip install -U anti-useragent

Check version via python console:

import anti_useragent

print(anti_useragent.VERSION)

Add awesome tools usage:

# requests:
from anti_useragent.utils.cipers import set_requests_cipers, set_tls_protocol

# ja3 tls verify
@set_requests_cipers
def get_html():
    requests.get(...)

# ja3 tls version
session = set_tls_protocol(version="TLSv1_2")


# aiohttp:
from anti_useragent.utils.cipers import sslgen
async with ClientSession(connector=aiohttp.TCPConnector(ssl=False)) as session:
    # ja3 tls verify
    await session.get(..., ssl=sslgen())

    # ja3 tls version
    await session.get(..., ssl=sslgen(_ssl="TLSv1_2"))

# scrapy:
# settings.py ja3 tls verify
DOWNLOADER_CLIENTCONTEXTFACTORY = 'anti_useragent.utils.scrapy_contextfactory.Ja3ScrapyClientContextFactory'

Metadata

Release files for anti-useragent 1.0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for anti-useragent 1.0.10
File Size Uploaded
anti_useragent-1.0.10.tar.gz 21.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for anti-useragent 1.0.10
File Interpreter ABI Platform
anti_useragent-1.0.10-py3-none-any.whl Python 3 none any Details

Total release size: 47.3 kB

Release files / anti_useragent-1.0.10.tar.gz

Download URL anti_useragent-1.0.10.tar.gz
Size 21.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f6be1f3a37d1d8563ec8971047fd7db870577f6634eea2d1bc69fc6a171a0ef9
BLAKE2b-256 checksum
How to use checksums
8860032598c1c9246f4673ef234e4e1ae65c9ed3e28ce965fa4dba771d727a1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

Release files / anti_useragent-1.0.10-py3-none-any.whl

Download URL anti_useragent-1.0.10-py3-none-any.whl
Size 25.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f2dc98b0a6d70d6cefb4443d916fbf392ded1685ba4f13c741c053485d3ef6fa
BLAKE2b-256 checksum
How to use checksums
d60ae4cb236131d5923b762bf389e2e35e5473d1781a857488b8678e4a90fa20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.0.10 This release

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.1

2 release files

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page