Need help with httpagentparser?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

shon
208 Stars 53 Forks MIT License 182 Commits 15 Opened issues

Description

Python HTTP Agent Parser

Services available

!
?

Need anything else?

Contributors list

# 345,401
Python
RSS
Atom
Shell
83 commits
# 485,304
Python
PHP
11 commits
# 132,297
vhdl
webrtc
parcel
Ada
9 commits
# 402,822
Python
amazon
python-...
4 commits
# 443,885
PHP
HTML
rubygem...
Shell
3 commits
# 393,842
amp-htm...
HTML
TypeScr...
amp
2 commits
# 184,928
Erlang
Shell
HTML
2 commits
# 386,775
Python
2 commits
# 88,942
interop...
python3
Shell
pelican
2 commits
# 99,215
sentry
linter-...
Django
python3
2 commits
# 310,252
HTML
Shell
Git
C
1 commit
# 734,928
Python
1 commit
# 48,432
React
css-in-...
HTML
TypeScr...
1 commit
# 82,304
HTML
python3
seleniu...
proxy-c...
1 commit
# 407,580
ldap-au...
HTML
Shell
C#
1 commit
# 342,611
PWA
service...
Python
1 commit
# 2,558
Applica...
error-m...
sentry
sentry-...
1 commit
# 84,191
Scala
jupyter
SQL
Apache ...
1 commit
# 97,395
HTML
materia...
TypeScr...
rfc-645...
1 commit
# 741,651
Python
1 commit

Downloads

PYPI

Travis

Features

  • Fast
  • Detects OS and Browser. Does not aim to be a full featured agent parser
  • Will not turn into django-httpagentparser ;)

Usage

>>> 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'}}

History

http://stackoverflow.com/questions/927552/parsing-http-user-agent-string/1151956#1151956

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.