We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
aldo195
8 years agoExplorer | Level 3
Unable to list linked devices
We want our app to be able to list linked devices without having access to files. We've granted the app the "Team auditing" permission type but when we try using the team_devices_list_team_devices() ...
- 8 years agoThat ValidationError should be fixed in the latest release of the Python SDK, currently v8.6.0. Please update to that and try again.
aldo195
8 years agoExplorer | Level 3
Is there a way to get some details about the devices (e.g. just the name) in one of the generated reports? Those are accessible to the audit user.
Greg-DB
Dropbox Community Moderator
8 years agoThe team_reports_get_devices, team_log_get_events, and team_log_get_events_continue methods are accessible to team auditing apps, so you can use those if they're sufficient for your use case.
The team_reports_get_devices method gives you statistics about the numbers of devices, but team_log_get_events, and team_log_get_events_continue do give some information about specific devices e.g., via EventType.device_link_success with DeviceLinkSuccessDetails.
- aldo1958 years agoExplorer | Level 3Great, that sounds promising. Can you point me to a code example of how to use team_log_get_events? When I run it as below it returns an error.
d = dbx.as_user('dbmid:XXXX')
d.team_log_get_events()
---------------------------------------------------------------------------
ValidationError Traceback (most recent call last)
<ipython-input-71-2e4c22857f63> in <module>()
----> 1 d.team_log_get_events()
~/anaconda3/lib/python3.6/site-packages/dropbox/base.py in team_log_get_events(self, limit, account_id, time, category)
4100 'team_log',
4101 arg,
-> 4102 None,
4103 )
4104 return r
~/anaconda3/lib/python3.6/site-packages/dropbox/dropbox.py in request(self, route, namespace, request_arg, request_binary, timeout)
248
249 deserialized_result = stone_serializers.json_compat_obj_decode(
--> 250 returned_data_type, obj, strict=False)
251
252 if isinstance(res, RouteErrorResult):
~/anaconda3/lib/python3.6/site-packages/dropbox/stone_serializers.py in json_compat_obj_decode(data_type, obj, caller_permissions, alias_validators, strict, old_style, for_msgpack)
978 else:
979 return decoder.json_compat_obj_decode_helper(
--> 980 data_type, obj)
981
982 # Adapted from:
~/anaconda3/lib/python3.6/site-packages/dropbox/stone_serializers.py in json_compat_obj_decode_helper(self, data_type, obj)
557 return self.decode_struct_tree(data_type, obj)
558 elif isinstance(data_type, bv.Struct):
--> 559 return self.decode_struct(data_type, obj)
560 elif isinstance(data_type, bv.Union):
561 if self.old_style:
~/anaconda3/lib/python3.6/site-packages/dropbox/stone_serializers.py in decode_struct(self, data_type, obj)
606 raise bv.ValidationError("unknown field '%s'" % key)
607 ins = data_type.definition()
--> 608 self.decode_struct_fields(ins, all_fields, obj)
609 # Check that all required fields have been set.
610 data_type.validate_fields_only_with_permissions(ins, self.caller_permissions)
~/anaconda3/lib/python3.6/site-packages/dropbox/stone_serializers.py in decode_struct_fields(self, ins, fields, obj)
625 if name in obj:
626 try:
--> 627 v = self.json_compat_obj_decode_helper(field_data_type, obj[name])
628 setattr(ins, name, v)
629 except bv.ValidationError as e:
~/anaconda3/lib/python3.6/site-packages/dropbox/stone_serializers.py in json_compat_obj_decode_helper(self, data_type, obj)
565 elif isinstance(data_type, bv.List):
566 return self.decode_list(
--> 567 data_type, obj)
568 elif isinstance(data_type, bv.Map):
569 return self.decode_map(
~/anaconda3/lib/python3.6/site-packages/dropbox/stone_serializers.py in decode_list(self, data_type, obj)
844 return [
845 self.json_compat_obj_decode_helper(data_type.item_validator, item)
--> 846 for item in obj]
847
848 def decode_map(self, data_type, obj):
~/anaconda3/lib/python3.6/site-packages/dropbox/stone_serializers.py in <listcomp>(.0)
844 return [
845 self.json_compat_obj_decode_helper(data_type.item_validator, item)
--> 846 for item in obj]
847
848 def decode_map(self, data_type, obj):
~/anaconda3/lib/python3.6/site-packages/dropbox/stone_serializers.py in json_compat_obj_decode_helper(self, data_type, obj)
557 return self.decode_struct_tree(data_type, obj)
558 elif isinstance(data_type, bv.Struct):
--> 559 return self.decode_struct(data_type, obj)
560 elif isinstance(data_type, bv.Union):
561 if self.old_style:
~/anaconda3/lib/python3.6/site-packages/dropbox/stone_serializers.py in decode_struct(self, data_type, obj)
608 self.decode_struct_fields(ins, all_fields, obj)
609 # Check that all required fields have been set.
--> 610 data_type.validate_fields_only_with_permissions(ins, self.caller_permissions)
611 return ins
612
~/anaconda3/lib/python3.6/site-packages/dropbox/stone_validators.py in validate_fields_only_with_permissions(self, val, caller_permissions)
489 Should only be called for callers with extra permissions.
490 """
--> 491 self.validate_fields_only(val)
492
493 # check if type has been patched
~/anaconda3/lib/python3.6/site-packages/dropbox/stone_validators.py in validate_fields_only(self, val)
480 if not hasattr(val, field_name):
481 raise ValidationError("missing required field '%s'" %
--> 482 field_name)
483
484 def validate_fields_only_with_permissions(self, val, caller_permissions):
ValidationError: events: missing required field 'involve_non_team_member'- aldo1958 years agoExplorer | Level 3Interestingly, this works:
d.team_log_get_events(limit=None, account_id=None, category=dropbox.team_log.EventCategory.members)
But this returns the error:
d.team_log_get_events(limit=None, account_id=None, category=dropbox.team_log.EventCategory.devices)- Greg-DB8 years ago
Dropbox Community Moderator
That code looks right, but there's currently an issue with the SDK that can result in that ValidationError. We're looking into it. I'll let you know when I have an update on it.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!