import humanize
actions = {
proj: {
'action': 'storage_usage',
'entity_type': 'Project',
'entity_id': proj['id'],
}
for proj in session.query('Project')
}
results = session.call(
list(actions.values())
)
width = max(len(proj['name']) for proj in actions)
for proj, result in zip(actions, results):
print(f"{proj['name']:{width}} {humanize.naturalsize(result['data'])}")
Here's an example of letting the server perform the calculation. results is an ord
Recommended Posts
Posted by Guest,
Example of the storage_usage API action.
0 reactions
Go to this post
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now