Skip to content

Fast and reliable User Agent parser for python

License

Notifications You must be signed in to change notification settings

mailgun/uasparser2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Fast and reliable User Agent parser for python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%