pyuser_agent
A user agent is any software that retrieves and presents Web content for end users or is implemented using Web technologies. User agents include Web browsers, media players, and plug-ins that help in retrieving, rendering and interacting with Web content.
INSTALL PACKAGE
pip install pyuser-agent
IMPORT PACKAGE
Python 3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyuser_agent
>>>
USAGE BROWSER NAME
get browser relative user_agent for platform random to generate
Python 3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyuser_agent
>>>
# assgin obj
>>> obj = pyuser_agent.UA()
>>>
# list of browsers
>>> obj.list
['chrome', 'chromeplus', 'edge', 'firefox', 'internet_explorer', 'mozilla', 'opera', 'safari']
>>>
# get user agent for browser
>>> obj.chrome
'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.861.0 Safari/535.2'
>>>
>>> obj.chromeplus
'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10 ChromePlus/1.5.2.0alpha1'
>>>
>>> obj.edge
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14931'
>>>
>>> obj.firefox
'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.3a3pre) Gecko/20100306 Firefox3.6 (.NET CLR 3.5.30729)'
>>>
>>> obj.internet_explorer
'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; chromeframe/12.0.742.100)'
>>>
>>> obj.mozilla
'Mozilla/5.0 (X11; U; FreeBSD i386; ja-JP; rv:1.7.2) Gecko/20050330'
>>>
>>> obj.opera
'Opera/9.80 (S60; SymbOS; Opera Tablet/9174; U; en) Presto/2.7.81 Version/10.5'
>>>
>>> obj.safari
'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/124 (KHTML, like Gecko)'
>>>
USAGE RANDOME
get browser user_agent for platform and browser random to generate
Python 3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyuser_agent
>>> obj = pyuser_agent.UA()
>>>
>>> obj.random
'Opera/9.80 (S60; SymbOS; Opera Tablet/9174; U; en) Presto/2.7.81 Version/10.5'
>>>
>>> obj.random
'Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8) Gecko/20060322 Firefox/2.0a1'
>>>
>>> obj.random
'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8) Gecko/20071004 Firefox/2.0.0.8 (Debian-2.0.0.8-1)'
>>>
>>>
EXCEPTION
input error key. random module execute
Python 3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyuser_agent
>>> obj = pyuser_agent.UA()
>>>
>>> obj.chr
WARNING:root:not match "chr". return random user agent.
'Mozilla/5.0 (X11; U; Linux i686 (x86_64); nl; rv:1.8.0.6) Gecko/20060728 SUSE/1.5.0.6-1.2 Firefox/1.5.0.6'
>>>
Metadata
Release files for pyuser-agent 0.1.0
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 |
|---|---|---|---|---|
| pyuser_agent-0.1.0.tar.gz | 45.6 kB | Without provenance | Details for pyuser_agent-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyuser_agent-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pyuser_agent-0.1.0-py3-none-any.whl |
Total release size: 132.6 kB
Release files / pyuser_agent-0.1.0.tar.gz
| Download URL | pyuser_agent-0.1.0.tar.gz |
|---|---|
| Size | 45.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a750def869cd43410a2278f39e003faa696a6e42962d4836e92ce6cee16a0b06
|
|
BLAKE2b-256 checksum How to use checksums |
e3bada1e0123421648ddd816d9a6c087fd7f667eef03d04b3a5ae21426ceb74f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.9
|
Release files / pyuser_agent-0.1.0-py3-none-any.whl
| Download URL | pyuser_agent-0.1.0-py3-none-any.whl |
|---|---|
| Size | 87.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
df34525a48a59bf458ca0e73f5a3e14bdab7102a0e933de41578c2d7db36eb42
|
|
BLAKE2b-256 checksum How to use checksums |
8eb220806c03aabd373f3aaa70029fa131665e5ec778e1875bcc21a74901cc7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.9
|
Security for pyuser-agent 0.1.0
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.