Skip to content

Latest commit

 

History

History
48 lines (29 loc) · 1.18 KB

README.md

File metadata and controls

48 lines (29 loc) · 1.18 KB

Fast and reliable User Agent parser for python

Author: Jure Ham ([email protected])

Forked from:

A python version of http://user-agent-string.info/download/UASparser

By Hicro Kee (http://hicrokee.com) email: hicrokee AT gmail DOT com

Modified by Michal Molhanec http://molhanec.net

Install:

pip install uasparser2

Usage:

from uasparser2 import UASparser

uas_parser = UASparser('/path/to/your/cache/folder', mem_cache_size=1000)

result = uas_parser.parse('YOUR_USERAGENT_STRING')

# If input data is not avaible in cache folde, UASparser will download and prepare it on init.
# Force data update by calling:

uas_parser.updateData()

Speed comparison:

Parsing 100,000 user agents (10,000 unique) from our server logs:

original uasparser: 7264.2 sec

uasparser2 without cache: 171.7 sec

uasparser2 with cache(size 1000): 34.6 sec

Bitdeli Badge