Skip to main content
==================================
useragent
==================================

useragent is a Python library that parses HTTP User-agent strings
and tries to give you as much data as possible in a normalized form.

It uses the data provided by the ua-parser project (originally collected by
Steve Souders). It aims to be more pythonic than the python wrapper found
in the original ua-parser project.

To-wit::

#!/usr/bin/env python

import useragent
ua = useragent.detect("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; nl; rv:1.9.0.1) Gecko/2008070206 Firefox/3.0.1")
print(ua)

Which would print ``ua``, a dict-like object with the following structure::
{
'device': {
'family': None,
'major_version': None,
'minor_version': None,
'patch_version': None
},
'os': {
'family': 'Mac OS X',
'major_version': '10',
'minor_version': '5',
'patch_version': None
},
'browser': {
'family': 'Firefox',
'major_version': '3',
'minor_version': '0',
'patch_version': '1'
}
}

The ``ua`` object actually has each of those keys exposed as attributes on itself, so you may find it more comfortable to navigate like so::
print(ua.browser.family)
print(ua.os.family)
print(ua.device.family)

Metadata

Release files for useragent 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for useragent 0.1.1
File Size Uploaded Provenance
useragent-0.1.1.tar.gz 134.8 kB Without provenance Details

Release files / useragent-0.1.1.tar.gz

Download URL useragent-0.1.1.tar.gz
Size 134.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7ef271df2dfdaa8d7eedcc9b7247009acdbd4e29d60924daba92f0b482ca32e2
BLAKE2b-256 checksum
How to use checksums
227a6380332af6b9e7bb1267adc8ac663758b329feb0d0baa20e46940a26b36d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for useragent 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page