Python3 module made as a wrapper of fake-useragent.
Project description
fakeua
Python3 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 pip
pip3 install --user -U 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fakeua-0.1.2.tar.gz
(3.2 kB
view details)
File details
Details for the file fakeua-0.1.2.tar.gz
.
File metadata
- Download URL: fakeua-0.1.2.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.32.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 961627f7c392acf67415319e392544c9bbd443ecb3fe8dce5c30961b67384bfb |
|
MD5 | 43605d6478472f738fc6dfd0976913d2 |
|
BLAKE2b-256 | d3794d4a87b1a8be55ecafd9dbb4584c01f8058618fb3aaa86794964f5b1a5bc |