Skip to main content

User-Agent parsing and creation

Project description

ua

User-Agent parsing and creation

Installation

pip install ua

Usage

>>> import ua

Parsing

>>> user_agent = ua.parse('Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0')
>>>
>>> user_agent
UserAgent(
    products=[
        Product(name='Mozilla', version='5.0', comments=['X11', 'Linux x86_64', 'rv:88.0']),
        Product(name='Gecko', version='20100101', comments=[]),
        Product(name='Firefox', version='88.0', comments=[])
    ]
)
>>>
>>> str(user_agent)
'Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0'

Creation

>>> user_agent = ua.UserAgent(
    products=[
        ua.Product(
            name='SomeProduct',
            version='1.0',
            comments=['SomeComment']
        )
    ]
)
>>>
>>> str(user_agent)
'SomeProduct/1.0 (SomeComment)'

References

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

ua-0.1.5.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

ua-0.1.5-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file ua-0.1.5.tar.gz.

File metadata

  • Download URL: ua-0.1.5.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.8.10 Linux/5.4.0-100-generic

File hashes

Hashes for ua-0.1.5.tar.gz
Algorithm Hash digest
SHA256 01bda1d1ae3b9c90e693bb18fb72c8a513aff5c7c9009f03b5a997512beaae62
MD5 90ce90fec4ccd64177a1b3765636acfb
BLAKE2b-256 a8ffe1d26615c067115ac61c31561142fb7bdb66c9cc2e8fd1cc15143efecf0f

See more details on using hashes here.

File details

Details for the file ua-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: ua-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.8.10 Linux/5.4.0-100-generic

File hashes

Hashes for ua-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2d67cf3a8f63e62f34b912d456d27fbfaa691b3ec34fab78da66ce9050b9ca4e
MD5 5f5ba7a691a8bb37c8af68f644418911
BLAKE2b-256 a6759890872c0f3c4fb1fccbbe595e2b7c05d8ce5bb07457730533e6d77c7016

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