-
Notifications
You must be signed in to change notification settings - Fork 21
/
GetDeviceID.py
33 lines (26 loc) · 830 Bytes
/
GetDeviceID.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/python
# Google Play Music device ID grabber
# Used to get a device ID from the Google Music API to use with the Mobileclient
# dan-nixon.com
# Date: 04/03/2014
import gmusicapi
from getpass import getpass
print "Username: ",
user = raw_input()
passwd = getpass()
api = gmusicapi.Webclient()
api.login(user, passwd)
devices = api.get_registered_devices()
# `devices` is a list of dictionaries like this:
# {u'carrier': u'Google',
# u'deviceType': 2,
# u'id': u'0x1111111111111111',
# u'lastAccessedFormatted': u'January 1, 1999',
# u'lastAccessedTimeMillis': 915148800,
# u'lastEventTimeMillis': 915148800,
# u'manufacturer': u'LGE',
# u'model': u'Nexus 5',
# u'name': u''}]
for device in devices:
if device['deviceType'] == 2:
print "Device:{d[manufacturer]} {d[model]}\tid:{d[id]}".format(d=device)