| 1 |
'''UniqueID facade. |
| 2 |
|
| 3 |
Returns the following depending on the platform: |
| 4 |
|
| 5 |
* **Android**: Android ID |
| 6 |
* **OS X**: Serial number of the device |
| 7 |
* **Linux**: Serial number using lshw |
| 8 |
* **Windows**: MachineGUID from regkey |
| 9 |
* **iOS**: UUID |
| 10 |
|
| 11 |
Simple Example |
| 12 |
-------------- |
| 13 |
|
| 14 |
To get the unique ID:: |
| 15 |
|
| 16 |
>>> from plyer import uniqueid |
| 17 |
>>> uniqueid.id |
| 18 |
'1b1a7a4958e2a845' |
| 19 |
|
| 20 |
.. versionadded:: 1.2.0 |
| 21 |
|
| 22 |
.. versionchanged:: 1.2.4 |
| 23 |
On Android returns Android ID instead of IMEI. |
| 24 |
|
| 25 |
Supported Platforms |
| 26 |
------------------- |
| 27 |
Android, iOS, Windows, OS X, Linux |
| 28 |
|
| 29 |
''' |
| 30 |
|
| 31 |
|
| 32 |
class UniqueID: |
| 33 |
''' |
| 34 |
UniqueID facade. |
| 35 |
''' |
| 36 |
|
| 37 |
@property |
| 38 |
def id(self): |
| 39 |
''' |
| 40 |
Property that returns the unique id of the platform. |
| 41 |
''' |
| 42 |
return self.get_uid() |
| 43 |
|
| 44 |
def get_uid(self): |
| 45 |
''' |
| 46 |
Public method for receiving unique ID via platform-specific |
| 47 |
API in plyer.platforms. |
| 48 |
''' |
| 49 |
return self._get_uid() |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
def _get_uid(self): |
| 54 |
raise NotImplementedError() |