从HTTP用户代理字符串中提取操作系统、浏览器等信息
项目描述
功能
快速
检测操作系统和浏览器。不旨在成为功能齐全的代理解析器
不会变成django-httpagentparser ;)
用法
>>> import httpagentparser
>>> s = "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/532.9 (KHTML, like Gecko) \
Chrome/5.0.307.11 Safari/532.9"
>>> print(httpagentparser.simple_detect(s))
('Linux', 'Chrome 5.0.307.11')
>>> print(httpagentparser.detect(s))
{'os': {'name': 'Linux'},
'browser': {'version': '5.0.307.11', 'name': 'Chrome'}}
>>> s = "Mozilla/5.0 (Linux; U; Android 2.3.5; en-in; HTC_DesireS_S510e Build/GRJ90) \
AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
>>> print(httpagentparser.simple_detect(s))
('Android Linux 2.3.5', 'Safari 4.0')
>>> print(httpagentparser.detect(s))
{'dist': {'version': '2.3.5', 'name': 'Android'},
'os': {'name': 'Linux'},
'browser': {'version': '4.0', 'name': 'Safari'}}
历史
http://stackoverflow.com/questions/927552/parsing-http-user-agent-string/1151956#1151956
项目详情
关闭
httpagentparser-1.9.5.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 53cefd9d65990f6fe59c0378cad8ea1b9df8f770d2e8bd9d8762edae033be80a |
|
MD5 | 34613e7d4b05731abf15d1e26607aa4e |
|
BLAKE2b-256 | bc4d1fc46c8a2c9a0ceb9e9580d7ce92bf764c373deb7af61fde2fd7b5516495 |