Skip to main content

WebCase device recognizing utility

Installation

pip install wc-django-device-recognizer

It depends on django-user-agents, so check out it's documentation about additional installation instructions.

In settings.py:

INSTALLED_APPS += [
  'wcd_device_recognizer',
]

Usage

To get all possible information from request:

from wcd_device_recognizer.services import request_resolver

interlocutor = request_resolver.resolve(request)

assert interlocutor.device.bitness == '64'
assert interlocutor.os.family == 'Linux'
assert interlocutor.os.arch == 'x86'
assert interlocutor.app.family == 'Chrome'
assert interlocutor.app.version == (101, 0, 0)
assert interlocutor.device.dpr == 1

And then you may save interlocutor's data to database:

from wcd_device_recognizer.services import registry

# You may pass any amount of interlocutors to register here.
registry.register_interlocutors((interlocutor,))

Coverage

To collect interlocutor's data package uses User-Agent info and standart HTTP headers:

  • Sec-CH-UA
  • Sec-CH-UA-Arch
  • Sec-CH-UA-Bitness
  • Sec-CH-UA-Full-Version
  • Sec-CH-UA-Full-Version-List
  • Sec-CH-UA-Mobileser experience.
  • Sec-CH-UA-Model
  • Sec-CH-UA-Platform
  • Sec-CH-UA-Platform-Version
  • Content-DPR
  • Device-Memory
  • DPR
  • Viewport-Width
  • Width

For details look here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers#user_agent_client_hints

Also any Sec-CH-UA-{key-name} will be saved.

To provide some unique device identifier use: Sec-CH-UA-ID header.

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[Unreleased]

[0.1.4]

Fixed

  • Headers: Sec-CH-UA, Sec-CH-UA-Full-Version-List, Sec-CH-UA-Full-Version support.

[0.1.2]

Added

  • IPv6 support.

[0.1.1]

Initial version.

Metadata

Release files for wc-django-device-recognizer 0.1.5

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

Source distribution (sdist)

Source distribution for wc-django-device-recognizer 0.1.5
File Size Uploaded Provenance
wc-django-device-recognizer-0.1.5.tar.gz 27.1 kB Without provenance Details

Release files / wc-django-device-recognizer-0.1.5.tar.gz

Download URL wc-django-device-recognizer-0.1.5.tar.gz
Size 27.1 kB
Tags Source
SHA-256 checksum
How to use checksums
90dea7ffe1bae41b00ab42977548aa1d70d9d453ea1b330e082d4619e1d7bc55
BLAKE2b-256 checksum
How to use checksums
9c6a11e107811d14e27681ed70813934e93b0240d02a587207432a7e886c58c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Security for wc-django-device-recognizer 0.1.5

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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