mirror of
https://github.com/GAM-team/GAM.git
synced 2025-07-08 05:33:34 +00:00
simplify cros/mobile info commands
This commit is contained in:
33
gam.py
33
gam.py
@ -4946,21 +4946,34 @@ def doGetCrosInfo():
|
|||||||
deviceId = sys.argv[3]
|
deviceId = sys.argv[3]
|
||||||
cd = buildGAPIObject(u'directory')
|
cd = buildGAPIObject(u'directory')
|
||||||
info = callGAPI(service=cd.chromeosdevices(), function=u'get', customerId=customerId, deviceId=deviceId)
|
info = callGAPI(service=cd.chromeosdevices(), function=u'get', customerId=customerId, deviceId=deviceId)
|
||||||
for key, value in info.items():
|
print_json(None, info)
|
||||||
if key in [u'kind', u'etag']:
|
|
||||||
continue
|
|
||||||
print u' %s: %s' % (key, value)
|
|
||||||
|
|
||||||
def doGetMobileInfo():
|
def doGetMobileInfo():
|
||||||
deviceId = sys.argv[3]
|
deviceId = sys.argv[3]
|
||||||
cd = buildGAPIObject(u'directory')
|
cd = buildGAPIObject(u'directory')
|
||||||
info = callGAPI(service=cd.mobiledevices(), function=u'get', customerId=customerId, resourceId=deviceId)
|
info = callGAPI(service=cd.mobiledevices(), function=u'get', customerId=customerId, resourceId=deviceId)
|
||||||
for key, value in info.items():
|
print_json(None, info)
|
||||||
if key == u'kind':
|
|
||||||
continue
|
def print_json(object_name, object_value, spacing=u''):
|
||||||
if key in [u'name', u'email']:
|
if object_name in [u'kind', u'etag', u'etags']:
|
||||||
value = value[0]
|
return
|
||||||
print u' %s: %s' % (key, value)
|
if object_name != None:
|
||||||
|
sys.stdout.write(u'%s%s: ' % (spacing, object_name))
|
||||||
|
if type(object_value) is list:
|
||||||
|
if len(object_value) == 1:
|
||||||
|
sys.stdout.write(u'%s\n' % object_value[0])
|
||||||
|
return
|
||||||
|
sys.stdout.write(u'\n')
|
||||||
|
for a_value in object_value:
|
||||||
|
if type(a_value) in (str, unicode):
|
||||||
|
print u' %s%s' % (spacing, a_value)
|
||||||
|
else:
|
||||||
|
print_json(object_name=None, object_value=a_value, spacing=u' %s' % spacing)
|
||||||
|
elif type(object_value) is dict:
|
||||||
|
for another_object in object_value.keys():
|
||||||
|
print_json(object_name=another_object, object_value=object_value[another_object], spacing=spacing)
|
||||||
|
else:
|
||||||
|
sys.stdout.write(u'%s\n' % (object_value))
|
||||||
|
|
||||||
def doUpdateNotification():
|
def doUpdateNotification():
|
||||||
cd = buildGAPIObject(u'directory')
|
cd = buildGAPIObject(u'directory')
|
||||||
|
Reference in New Issue
Block a user