py-machineid is a Python library designed to retrieve the unique machine ID (UUID/GUID) of any host without requiring administrative privileges. It extracts the operating system's native machine identifier, which is generally stable for a given OS installation. The library also offers a cryptographically hashed version of the ID, useful for application-specific identification. The current version is 1.0.0, and it maintains an active development status, with updates released as needed for bug fixes and feature enhancements.
pip install py-machineidVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to retrieve both the raw, native machine ID and an anonymized, application-specific hashed ID. It also shows how to optionally disable the Windows registry query for added control over fingerprinting. Error handling is included for robust usage.
If you were using `hashed_id()` prior to v1.0.0 and relied on its persistence, note that existing hashed IDs will no longer match. Update any systems or databases that depend on these values accordingly.
Consider your security posture and desired ID consistency. If you need to prevent potential fingerprint tampering via registry modification, use `machineid.id(winregistry=False)` or `machineid.hashed_id(app_id, winregistry=False)`.
Be aware that the ID is not immutable. For application-specific, non-admin-alterable unique IDs, consider using `hashed_id()` with a unique `app_id` to add an additional layer of distinction.
This is typically a warning and doesn't prevent the library from functioning correctly. It can be ignored or suppressed. A future library update may address this directly.
For identifying an application instance on a machine, use `machineid.hashed_id('your_application_identifier')` instead of `machineid.id()`. The hashed ID is cryptographically secure and suitable for public-facing use.Run `pip install py-machineid` in your terminal to install the library.
Call the functions with parentheses: `machineid.id()` or `machineid.hashed_id('your-app-id')`.Ensure that the `app_id` argument passed to `machineid.hashed_id()` is always a string, for example: `machineid.hashed_id('my_application')`.No dependency data recorded yet.