box-python-sdk 没有为获取企业用户和获取组返回 total_count

box-python-sdk is not returning total_count for Get Enterprise Users and Get Group

box-python-sdk 方法 'Get Enterprise users' 和 'Get Group' 支持 'Offset-based Paging',根据 api docs 他们应该 return total_count, limit, offset 个可用于下一个 request/pagination 的字段。

# sdk method to get enterprise users
users = client.users(limit=1000, offset=0, filter_term=None, user_type=None, fields=fields)  

print(vars(users))  
#output  
{'_session': <boxsdk.session.session.AuthorizedSession object at 0x7f3382a6b400>,  
'_url': 'https://api.box.com/2.0/users', '_limit': 1000,  
'_fields': ['type', 'id', 'name', 'login', 'created_at', 'modified_at',  
       'language', 'timezone', 'space_amount', 'space_used', 'max_upload_size',  
       'status', 'job_title', 'phone', 'address', 'avatar_url', 'role',  
       'tracking_codes', 'can_see_managed_users', 'is_sync_enabled',  
       'is_external_collab_restricted',  'is_exempt_from_device_limits',  
       'is_exempt_from_login_verification', 'enterprise', 'my_tags', 'hostname',  
       'is_platform_access_only'],  
'_additional_params': {'user_type': 'managed'},   
'_return_full_pages': False,   
'_has_retrieved_all_items': False,   
'_all_items': None,   
'_offset': 0}

它不会 return total_count 并且方法 client.get_groups() 也是如此。
我仔细检查了 box-api 是 returning total_count。我是犯了什么错误还是 sdk 中有错误。

我在 github 上得到了这个问题的答案。如果有人来这里谷歌搜索,我会为他们发布这个。

不幸的是,total_count 字段未随迭代器公开。但是,如果您手动调用 returns 一个 JSON 对象,您可以取回 total_count。

像这样:

client.make_request('GET', 'https://api.box.com/2.0/users').

更多详情click