Python module made as a wrapper of fake-useragent.
Project description
fakeua
Python module made as a wrapper of fake-useragent.
Rationale:
fake-useragent package (https://github.com/hellysmile/fake-useragent) have an API which is brittle and too verbose for cases when you just want predictability and the work done without unnecesary headaches.
Installation
Install with uv
uv add fakeua
Usage
FakeUA can be used from the shell too.
fakeua -h
Or importing its functions.
In [1]: import fakeua
# Update useragent DB in a json file (~/.fakeua_databrowsers.json)
In [2]: fakeua.update_useragent_db()
Out[2]: True
In [3]: fakeua.get_useragent_list()
Out[3]:
['Mozilla/5.0 (X11; Linux i686; rv:64.0) Gecko/20100101 Firefox/64.0',
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0',
'Mozilla/5.0 (X11; Linux i586; rv:63.0) Gecko/20100101 Firefox/63.0',
'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:63.0) Gecko/20100101 Firefox/63.0',
'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.10; rv:62.0) Gecko/20100101 Firefox/62.0']
In [4]: fakeua.load_useragent_db()
Out[4]: ...
# It throws a dict containing the browsers scraped by fake-useragent.
In [5]: fakeua.get_random_ua()
Out[5]: 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:63.0) Gecko/20100101 Firefox/63.0'
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fakeua-0.2.0.tar.gz.
File metadata
- Download URL: fakeua-0.2.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e21ad9b3c7f87d0485d461d2c999f3a290de83e344ad137b0a00a17971c3172b
|
|
| MD5 |
f9d5f5d851a7b6e5bb8c52a3444acb03
|
|
| BLAKE2b-256 |
34d00c491f4eead1418a0797b6ffd1194d322e643b4e7cfd32f77752982e0d55
|
File details
Details for the file fakeua-0.2.0-py3-none-any.whl.
File metadata
- Download URL: fakeua-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bc5a18d188c18d1e6a6baea233b95a87fadd71d56a5ecbb6443756555d9164c
|
|
| MD5 |
e8b3c8c6a670ff241ba67e339da40ac7
|
|
| BLAKE2b-256 |
272326ace3a988475c60ed3055a354669fa46d8138ebe3145230ab59556e7034
|