useragent-changer
A library for changing user agents in order to verify the operation of web systems.
Features
- This package contains User-Agent data for a total of 19,381 for the platforms listed below.
- Android (2,144), Chrome (4,996), Edge (91), Firefox (2,132), iPad (45), iPhone (750), Mac (1,739), Safari (4,952), Windows (2,532)
- User-Agent corresponding to each platform is described in 9 CSV files in the data folder in this package.
- Supports Python 3.x
Installation
Enter one of the following two commands:
pip3 install useragent-changer
pip3 install git+https://github.com/gitmori/useragent-changer
Downloads
Usage
from useragent_changer import UserAgent
ua = UserAgent('android')
print(ua.set())
# Dalvik/2.1.0 (Linux; U; Android 10; ASUS_Z01RD Build/QKQ1.191008.001)
ua = UserAgent('iphone')
print(ua.set())
# Mozilla/5.0 (iPhone; CPU iPhone OS 12_5_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Mobile/15E148 Safari/604.1
ua = UserAgent('ipad')
print(ua.set())
# Mozilla/5.0 (iPad; CPU OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/94.0.4606.76 Mobile/15E148 Safari/604.1
ua = UserAgent('windows')
print(ua.set())
# Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)
ua = UserAgent('mac')
print(ua.set())
# Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:49.0) Gecko/20100101 Firefox/49.0
ua = UserAgent('chrome')
print(ua.set())
# Mozilla / 5.0 (Windows NT 10.0; Win64; x64) AppleWebKit / 537.36 (KHTML, like Gecko) Chrome / 74.0.3729.169 Safari / 537.36
ua = UserAgent('edge')
print(ua.set())
# Mozilla/5.0 (Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.9200
ua = UserAgent('safari')
print(ua.set())
# Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; ja) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.1.0.523 Mobile Safari/534.11+
ua = UserAgent('firefox')
print(ua.set())
# Dalvik/2.1.0 (Linux; U; Android 10; ASUS_Z01RD Build/QKQ1.191008.001)
ua = UserAgent()
print(ua.set())
# Get a random User-Agent
Test
If you don't have Selenium installed, run the following command: pip3 install selenium
from selenium.webdriver import ChromeOptions, Chrome
from useragent_changer import UserAgent
from time import sleep
PLATFORM= 'firefox'
URL = 'https://develop.tools/env-variable/'
ua = UserAgent(PLATFORM)
options = ChromeOptions()
options.add_argument('--ignore-certificate-errors')
options.add_argument('--user-agent=' + ua.set())
driver = Chrome(options=options)
driver.get(URL)
SECONDS = 5
sleep(SECONDS)
driver.quit()
Changelog
- 0.1.1 August 02, 2023
- First push
- 0.3.2 September 12, 2023
- Fixed comments in module file
Author
Yuki Moriya (gitmori)
ym19820219@gmail.com
Licence
Copyright (c) 2023 Yuki Moriya
This software is released under the MIT License, see LICENSE.txt.
Metadata
Release files for useragent-changer 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| useragent_changer-0.3.2.tar.gz | 148.4 kB | Without provenance | Details for useragent_changer-0.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| useragent_changer-0.3.2-py3-none-any.whl | Python 3 | none | any | Details for useragent_changer-0.3.2-py3-none-any.whl |
Total release size: 306.4 kB
Release files / useragent_changer-0.3.2.tar.gz
| Download URL | useragent_changer-0.3.2.tar.gz |
|---|---|
| Size | 148.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e69b0f95b62a9a5e15f7b718c75ad238eb827b6dfd238d34ef212931cbec3d94
|
|
BLAKE2b-256 checksum How to use checksums |
c96867b2957b5ec1b196401e01c4a87cc146e5a9035960c1be43e006681e08d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / useragent_changer-0.3.2-py3-none-any.whl
| Download URL | useragent_changer-0.3.2-py3-none-any.whl |
|---|---|
| Size | 158.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
03ff69c6c1ebbba46fe12a9b4c68df58533530b095d921464b25df49be39a3d1
|
|
BLAKE2b-256 checksum How to use checksums |
3876b2799ef92a77fca35ae5da12c2857bfb40cf20f30c7c0a4762bf2457bb05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Security for useragent-changer 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.