PyMobileDetect is a Python library that detects mobile and tablet browsers based on the User-Agent string. It is a port of the popular PHP Mobile Detect library. The current version is 1.3.2, with releases being infrequent but stable, primarily aligning with updates to the underlying detection rules.
pip install pymobiledetectVerified import paths — ran on the pinned version, not inferred.
Initialize MobileDetect with a User-Agent string and use its methods to check device type and properties. The User-Agent string is crucial for correct detection.
Always use `from mobiledetect import MobileDetect` after `pip install pymobiledetect`.
Ensure you are using the latest available version of `pymobiledetect`. For critical applications, consider regularly reviewing its detection accuracy against new User-Agent strings and updating the library.
Always pass the full and accurate User-Agent string received from the client. Validate or sanitize inputs if there's a risk of malformed data.
Change your import statement from `from pymobiledetect import MobileDetect` to `from mobiledetect import MobileDetect`.
Provide a User-Agent string when creating an instance, e.g., `detector = MobileDetect(user_agent='...')`. In web applications, this typically comes from `request.headers['User-Agent']`.
Ensure you have the latest version of `pymobiledetect` installed via `pip install --upgrade pymobiledetect`. If the issue persists, the underlying detection rules (inherited from the PHP project) might not yet include data for your specific device.
No dependency data recorded yet.