Skip to content

ua-parser

641 6 9 Apache-2.0
1.0.1 (1 Feb 2025) Dec 29 2012 23.5 million (month)

ua-parser is an User-Agent header string parser for Python. It's inspired by javascript package with the same name ua-parser and performs identifcal functionality but in Python.

In web scraping, ua-parser is used in anti-scraping bypass. It helps to design user agent string rotation in scraper fingerprinting by providing consisten and reliably information about user agents.

Example Use


```python from ua_parser import user_agent_parser

user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:106.1) Gecko/20100020 Firefox/109.0" parsed = user_agent_parser.Parse(user_agent) print(parsed) { "device": { "brand": "Apple", "family": "Mac", "model": "Mac", }, "os": { "family": "Mac OS X", "major": "10", "minor": "15", "patch": None, "patch_minor": None, }, "string": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:106.1) Gecko/20100020 Firefox/109.0", "user_agent": { "family": "Firefox", "major": "109", "minor": "0", "patch": None, }, } ```

Alternatives / Similar


6,431 1.2.71 (2023-04-25 23:20:15 ago) Dec 28 2012 compare

Other Languages

Was this page helpful?