Fast and reliable User Agent parser for Python
Project description
Fast and reliable User Agent parser for Python
==============================================
Author: The Udger.com Team (info@udger.com)
- Tested with more the 50.000 unique user agents.
- Up to date data provided by https://udger.com/
- Support for Python 3
Forked from:
---------
Based on the code by Jure Ham (jure.ham@zemanta.com),
https://github.com/hamaxx/uasparser2
Previously, a python version of https://github.com/kaittodesk/uasparser2
by Hicro Kee (http://hicrokee.com) email: hicrokee AT gmail DOT com
and modified by Michal Molhanec http://molhanec.net
Usage:
------
$ git clone https://github.com/udger/udger-python
$ cd udger-python/
# python setup.py install
$ python
>>> from pprint import pprint
>>> from udger import Udger
>>> udger = Udger(access_key='YOUR-ACCESS-KEY')
>>> result = udger.parse(
... 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9'
... )
>>> pprint(result)
{'device_icon': u'https://udger.com/pub/img/device/desktop.png',
'device_name': u'Personal computer',
'device_udger_url': u'https://udger.com/resources/ua-list/device-detail?device=Personal%20computer',
'os_company': u'Apple Computer, Inc.',
'os_company_url': u'http://www.apple.com/',
'os_family': u'OS X',
'os_icon': u'https://udger.com/pub/img/os/macosx.png',
'os_name': u'OS X 10.11 El Capitan',
'os_url': u'https://en.wikipedia.org/wiki/OS_X_El_Capitan',
'type': u'Browser',
'ua_company': u'Apple Inc.',
'ua_company_url': u'http://www.apple.com/',
'ua_family': u'Safari',
'ua_icon': u'https://udger.com/pub/img/ua/safari.png',
'ua_name': u'Safari 9.0.2',
'ua_udger_url': u'https://udger.com/resources/ua-list/browser-detail?browser=Safari',
'ua_url': u'https://en.wikipedia.org/wiki/Safari_%28web_browser%29'}
>>> result = udger.parse('Some Thing')
>>> pprint(result)
{'device_icon': u'https://udger.com/pub/img/device/desktop.png',
'device_name': u'Personal computer',
'device_udger_url': u'https://udger.com/resources/ua-list/device-detail?device=Personal%20computer',
'os_company': None,
'os_company_url': None,
'os_family': None,
'os_icon': 'https://udger.com/pub/img/os/unknown.png',
'os_name': None,
'os_url': None,
'type': None,
'ua_company': None,
'ua_company_url': None,
'ua_family': None,
'ua_icon': 'https://udger.com/pub/img/ua/unknown.png',
'ua_name': None,
'ua_udger_url': None,
'ua_url': None}
==============================================
Author: The Udger.com Team (info@udger.com)
- Tested with more the 50.000 unique user agents.
- Up to date data provided by https://udger.com/
- Support for Python 3
Forked from:
---------
Based on the code by Jure Ham (jure.ham@zemanta.com),
https://github.com/hamaxx/uasparser2
Previously, a python version of https://github.com/kaittodesk/uasparser2
by Hicro Kee (http://hicrokee.com) email: hicrokee AT gmail DOT com
and modified by Michal Molhanec http://molhanec.net
Usage:
------
$ git clone https://github.com/udger/udger-python
$ cd udger-python/
# python setup.py install
$ python
>>> from pprint import pprint
>>> from udger import Udger
>>> udger = Udger(access_key='YOUR-ACCESS-KEY')
>>> result = udger.parse(
... 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9'
... )
>>> pprint(result)
{'device_icon': u'https://udger.com/pub/img/device/desktop.png',
'device_name': u'Personal computer',
'device_udger_url': u'https://udger.com/resources/ua-list/device-detail?device=Personal%20computer',
'os_company': u'Apple Computer, Inc.',
'os_company_url': u'http://www.apple.com/',
'os_family': u'OS X',
'os_icon': u'https://udger.com/pub/img/os/macosx.png',
'os_name': u'OS X 10.11 El Capitan',
'os_url': u'https://en.wikipedia.org/wiki/OS_X_El_Capitan',
'type': u'Browser',
'ua_company': u'Apple Inc.',
'ua_company_url': u'http://www.apple.com/',
'ua_family': u'Safari',
'ua_icon': u'https://udger.com/pub/img/ua/safari.png',
'ua_name': u'Safari 9.0.2',
'ua_udger_url': u'https://udger.com/resources/ua-list/browser-detail?browser=Safari',
'ua_url': u'https://en.wikipedia.org/wiki/Safari_%28web_browser%29'}
>>> result = udger.parse('Some Thing')
>>> pprint(result)
{'device_icon': u'https://udger.com/pub/img/device/desktop.png',
'device_name': u'Personal computer',
'device_udger_url': u'https://udger.com/resources/ua-list/device-detail?device=Personal%20computer',
'os_company': None,
'os_company_url': None,
'os_family': None,
'os_icon': 'https://udger.com/pub/img/os/unknown.png',
'os_name': None,
'os_url': None,
'type': None,
'ua_company': None,
'ua_company_url': None,
'ua_family': None,
'ua_icon': 'https://udger.com/pub/img/ua/unknown.png',
'ua_name': None,
'ua_udger_url': None,
'ua_url': None}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
udger-0.1.tar.gz
(5.2 kB
view details)
Built Distribution
udger-0.1-py2-none-any.whl
(8.2 kB
view details)
File details
Details for the file udger-0.1.tar.gz
.
File metadata
- Download URL: udger-0.1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbfa78e45311f203e09232f9748ae68aca45317e20e5c3c6ce9ba06022ee3f7a |
|
MD5 | 792ff64b8f09e0e3444d00ad5627634e |
|
BLAKE2b-256 | 7755bec2858cc52ac54d301c59f8e2944c3684bb40d22890166f2a9671001b44 |
File details
Details for the file udger-0.1-py2-none-any.whl
.
File metadata
- Download URL: udger-0.1-py2-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31d0300371057eb4d734d496e7aaaa2a8bb48b2b5f53668e0f0c66dc53c32a15 |
|
MD5 | a64f80ebce70a8cf1b874a51088fa2be |
|
BLAKE2b-256 | 1eef6431ca383401a4dd9fc18b67984b33044316001f9ce33cfd85edbbb3a825 |