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
ua.chrome
ua['chrome']
ua.firefox
ua['firefox']
ua.android
ua.iphone
ua.wechat
ua.random
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')
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)
ua = UserAgent(versions=(90, 100))
If You want to specify the enable logger just:
from anti_useragent import UserAgent
ua = UserAgent(logger=True)
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:
from anti_useragent.utils.cipers import set_requests_cipers, set_tls_protocol
@set_requests_cipers
def get_html():
requests.get(...)
session = set_tls_protocol(version="TLSv1_2")
from anti_useragent.utils.cipers import sslgen
async with ClientSession(connector=aiohttp.TCPConnector(ssl=False)) as session:
await session.get(..., ssl=sslgen())
await session.get(..., ssl=sslgen(_ssl="TLSv1_2"))
DOWNLOADER_CLIENTCONTEXTFACTORY = 'anti_useragent.utils.scrapy_contextfactory.Ja3ScrapyClientContextFactory'