woothee
raw JSON → 1.10.1 verified Fri May 01 auth: no python maintenance
Cross-language user agent classification library, Python implementation. Version 1.10.1. Unmaintained since 2020; no recent releases.
pip install woothee Common errors
error ModuleNotFoundError: No module named 'woothee.parser' ↓
cause Importing submodules that don't exist; `parse` is at top level.
fix
Use
from woothee import parse. error KeyError: 'name' ↓
cause Assuming `parse` returns an object with attributes instead of a dict.
fix
Access fields with
result['name'], not result.name. Warnings
gotcha The `parse` function returns a dict with string keys, not an object. Access fields like `result['name']`. ↓
fix Use dictionary access, not attribute access.
deprecated The library is no longer maintained. Consider using `ua-parser` or `user-agents` for active development. ↓
fix Switch to a maintained alternative or fork.
Imports
- parse wrong
from woothee.parser import parsecorrectfrom woothee import parse - Classifier wrong
from woothee.classifier import Classifiercorrectfrom woothee import Classifier
Quickstart
from woothee import parse
user_agent = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'
result = parse(user_agent)
print(result)
# Output: {'name': 'Googlebot', 'category': 'crawler', 'os': 'UNKNOWN', 'os_version': 'UNKNOWN', 'version': '2.1', 'vendor': 'GoogleInc.'}