Skip to main content

Extracts OS Browser etc information from http user agent string

Project description

http://pepy.tech/badge/httpagentparser https://img.shields.io/pypi/v/httpagentparser.svg https://img.shields.io/travis/shon/httpagentparser.svg https://img.shields.io/travis/shon/httpagentparser.svg

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

httpagentparser-1.9.1.tar.gz (7.9 kB view details)

Uploaded Source

File details

Details for the file httpagentparser-1.9.1.tar.gz.

File metadata

  • Download URL: httpagentparser-1.9.1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.5

File hashes

Hashes for httpagentparser-1.9.1.tar.gz
Algorithm Hash digest
SHA256 ef763d31993dd761825acee6c8b34be32b95cf1675d1c73c3cd35f9e52831b26
MD5 7fa39fbbdfd86f6c18caa218d0ddb4ad
BLAKE2b-256 3e893e80644a280c1b416faf9b3c56a016702fa3abae7502e348dfaf67217f67

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page