# 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 | [中文](./doc/README_ZH.md)
### Installation
```shell
pip install anti-useragent
```
### Usage
```python
from anti_useragent import UserAgent
ua = UserAgent()
ua.opera
# Opera/9.80 (X11; Linux i686; U; ru) Presto/2.8.131 Version/11.11
ua.chrome
# Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36
ua['chrome']
# Mozilla/5.0 (Windows NT 5.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.2.3576.5 Safari/537.36
ua.firefox
# Mozilla/5.0 (Windows NT 5.1; WOW64; rv:47.0) Gecko/20100101 Firefox/45.0
ua['firefox']
# Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:49.0) Gecko/20100101 Firefox/31.0
ua.android
# Mozilla/5.0 (Linux; Android 7.5.2; M571C Build/LMY47D) AppleWebKit/666.7 (KHTML, like Gecko) Chrome/72.7.7953.78 Mobile Safari/666.7
ua.iphone
# Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_1 like Mac OS X) AppleWebKit/349.56 (KHTML, like Gecko) Mobile/J9UMJN baiduboxapp/0_17.7.6.6_enohpi_8957_628/2.01_4C2%258enohPi/1099a/P0SJ2RX4DXJT3RW906040KVOSH2E76RJUNHVIJUPCJQCZMEM2GL/1
ua.wechat
# Mozilla/5.0 (Linux; Android 10.9.8; MI 5 Build/NRD90M) AppleWebKit/536.93 (KHTML, like Gecko) Chrome/81.7.8549.56 Mobile Safari/536.93
# and the best one, random via real world browser usage statistic
ua.random
# Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.3.8610.5 Safari/537.36
```
### Supported platform
| browser/platfom | windows | mac | linux | iphone | android |
| :-------------: | :-----: | :--: | :---: | :----: | :-----: |
| **chrome** | ✔ | ✔ | ✔ | ✔ | ✔ |
| **firefox** | ✔ | ✔ | ✔ | ❌ | ❌ |
| **opera** | ✔ | ✔ | ✔ | ❌ | ❌ |
| **wechat** | ❌ | ❌ | ❌ | ✔ | ✔ |
| **baidu** | ❌ | ❌ | ❌ | ✔ | ✔ |
| **uc** | ❌ | ❌ | ❌ | ❌ | ✔ |
If You want to specify the platform just:
```python
from anti_useragent import UserAgent
ua = UserAgent(platform='mac') # windows, linux, android, iphone
```
If You want to specify the browser max version or min version just:
```python
from anti_useragent import UserAgent
ua = UserAgent(max_version=90)
ua = UserAgent(min_version=50)
# 1.0.9 new supported
ua = UserAgent(versions=(90, 100))
```
If You want to specify the enable logger just:
```python
from anti_useragent import UserAgent
ua = UserAgent(logger=True)
# the default install loguru
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:
```python
# requests:
from anti_useragent.utils.cipers import set_requests_cipers, set_tls_protocol
# ja3 tls verify
@set_requests_cipers
def get_html():
requests.get(...)
# ja3 tls version
session = set_tls_protocol(version="TLSv1_2")
# aiohttp:
from anti_useragent.utils.cipers import sslgen
async with ClientSession(connector=aiohttp.TCPConnector(ssl=False)) as session:
# ja3 tls verify
await session.get(..., ssl=sslgen())
# ja3 tls version
await session.get(..., ssl=sslgen(_ssl="TLSv1_2"))
# scrapy:
# settings.py ja3 tls verify
DOWNLOADER_CLIENTCONTEXTFACTORY = 'anti_useragent.utils.scrapy_contextfactory.Ja3ScrapyClientContextFactory'
```
Raw data
{
"_id": null,
"home_page": "https://github.com/ihandmine/anti-useragent",
"name": "anti-useragent",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7.0",
"maintainer_email": "",
"keywords": "user,agent,user agent,useragent,fake,fake useragent,fake user agent,anti,anti useragent",
"author": "handmine",
"author_email": "handmine@outlook.com",
"download_url": "https://files.pythonhosted.org/packages/88/60/032598c1c9246f4673ef234e4e1ae65c9ed3e28ce965fa4dba771d727a1d/anti_useragent-1.0.10.tar.gz",
"platform": null,
"description": "# anti-useragent\n\n\n\n> info: fake pc or app browser useragent, anti useragent, and other awesome tools\n\n## Features\n\n- more browser up to date\n- more randomize ruler\n- more fun awesome tools\n\nEnglish | [\u4e2d\u6587](./doc/README_ZH.md)\n\n### Installation\n\n```shell\npip install anti-useragent\n```\n\n### Usage\n\n```python\nfrom anti_useragent import UserAgent\nua = UserAgent()\n\nua.opera\n# Opera/9.80 (X11; Linux i686; U; ru) Presto/2.8.131 Version/11.11\nua.chrome\n# Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36\nua['chrome']\n# Mozilla/5.0 (Windows NT 5.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.2.3576.5 Safari/537.36\nua.firefox\n# Mozilla/5.0 (Windows NT 5.1; WOW64; rv:47.0) Gecko/20100101 Firefox/45.0\nua['firefox']\n# Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:49.0) Gecko/20100101 Firefox/31.0\nua.android\n# Mozilla/5.0 (Linux; Android 7.5.2; M571C Build/LMY47D) AppleWebKit/666.7 (KHTML, like Gecko) Chrome/72.7.7953.78 Mobile Safari/666.7\nua.iphone\n# Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_1 like Mac OS X) AppleWebKit/349.56 (KHTML, like Gecko) Mobile/J9UMJN baiduboxapp/0_17.7.6.6_enohpi_8957_628/2.01_4C2%258enohPi/1099a/P0SJ2RX4DXJT3RW906040KVOSH2E76RJUNHVIJUPCJQCZMEM2GL/1\nua.wechat\n# Mozilla/5.0 (Linux; Android 10.9.8; MI 5 Build/NRD90M) AppleWebKit/536.93 (KHTML, like Gecko) Chrome/81.7.8549.56 Mobile Safari/536.93\n\n# and the best one, random via real world browser usage statistic\nua.random\n# Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.3.8610.5 Safari/537.36\n```\n\n### Supported platform\n\n| browser/platfom | windows | mac | linux | iphone | android |\n| :-------------: | :-----: | :--: | :---: | :----: | :-----: |\n| **chrome** | \u2714 | \u2714 | \u2714 | \u2714 | \u2714 |\n| **firefox** | \u2714 | \u2714 | \u2714 | \u274c | \u274c |\n| **opera** | \u2714 | \u2714 | \u2714 | \u274c | \u274c |\n| **wechat** | \u274c | \u274c | \u274c | \u2714 | \u2714 |\n| **baidu** | \u274c | \u274c | \u274c | \u2714 | \u2714 |\n| **uc** | \u274c | \u274c | \u274c | \u274c | \u2714 |\n\nIf You want to specify the platform just: \n\n```python\nfrom anti_useragent import UserAgent\nua = UserAgent(platform='mac') # windows, linux, android, iphone\n```\n\nIf You want to specify the browser max version or min version just: \n\n```python\nfrom anti_useragent import UserAgent\nua = UserAgent(max_version=90)\n\nua = UserAgent(min_version=50)\n\n# 1.0.9 new supported\nua = UserAgent(versions=(90, 100))\n```\n\nIf You want to specify the enable logger just: \n\n```python\nfrom anti_useragent import UserAgent\nua = UserAgent(logger=True)\n\n# the default install loguru\ntry:\n from loguru import logger\nexcept:\n install(\"loguru\")\n from loguru import logger\n```\n\n\n\nMake sure that You using latest version\n\n```\npip install -U anti-useragent\n```\n\nCheck version via python console: \n\n```\nimport anti_useragent\n\nprint(anti_useragent.VERSION)\n```\nAdd awesome tools usage:\n```python\n# requests:\nfrom anti_useragent.utils.cipers import set_requests_cipers, set_tls_protocol\n\n# ja3 tls verify\n@set_requests_cipers\ndef get_html():\n requests.get(...)\n\n# ja3 tls version\nsession = set_tls_protocol(version=\"TLSv1_2\")\n\n\n# aiohttp:\nfrom anti_useragent.utils.cipers import sslgen\nasync with ClientSession(connector=aiohttp.TCPConnector(ssl=False)) as session:\n # ja3 tls verify\n await session.get(..., ssl=sslgen())\n\n # ja3 tls version\n await session.get(..., ssl=sslgen(_ssl=\"TLSv1_2\"))\n\n# scrapy:\n# settings.py ja3 tls verify\nDOWNLOADER_CLIENTCONTEXTFACTORY = 'anti_useragent.utils.scrapy_contextfactory.Ja3ScrapyClientContextFactory'\n\n```\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "fake pc or app browser useragent, anti useragent, and other awesome tools",
"version": "1.0.10",
"project_urls": {
"Homepage": "https://github.com/ihandmine/anti-useragent"
},
"split_keywords": [
"user",
"agent",
"user agent",
"useragent",
"fake",
"fake useragent",
"fake user agent",
"anti",
"anti useragent"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d60ae4cb236131d5923b762bf389e2e35e5473d1781a857488b8678e4a90fa20",
"md5": "f40d268a2f04da62057cd83d55b5eb95",
"sha256": "f2dc98b0a6d70d6cefb4443d916fbf392ded1685ba4f13c741c053485d3ef6fa"
},
"downloads": -1,
"filename": "anti_useragent-1.0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f40d268a2f04da62057cd83d55b5eb95",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7.0",
"size": 25854,
"upload_time": "2022-09-19T07:04:04",
"upload_time_iso_8601": "2022-09-19T07:04:04.985263Z",
"url": "https://files.pythonhosted.org/packages/d6/0a/e4cb236131d5923b762bf389e2e35e5473d1781a857488b8678e4a90fa20/anti_useragent-1.0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8860032598c1c9246f4673ef234e4e1ae65c9ed3e28ce965fa4dba771d727a1d",
"md5": "16678eea61ff0e8d9e3e5fcd8aba086f",
"sha256": "f6be1f3a37d1d8563ec8971047fd7db870577f6634eea2d1bc69fc6a171a0ef9"
},
"downloads": -1,
"filename": "anti_useragent-1.0.10.tar.gz",
"has_sig": false,
"md5_digest": "16678eea61ff0e8d9e3e5fcd8aba086f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7.0",
"size": 21445,
"upload_time": "2022-09-19T07:04:06",
"upload_time_iso_8601": "2022-09-19T07:04:06.810063Z",
"url": "https://files.pythonhosted.org/packages/88/60/032598c1c9246f4673ef234e4e1ae65c9ed3e28ce965fa4dba771d727a1d/anti_useragent-1.0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-09-19 07:04:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ihandmine",
"github_project": "anti-useragent",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "anti-useragent"
}