Last active
August 29, 2015 13:56
-
-
Save rgbkrk/8807115 to your computer and use it in GitHub Desktop.
CloudFiles Summary in ORD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The Rackspace SDK for Python | |
import pyrax | |
# For printing pretty byte totals | |
import humanize | |
pyrax.set_setting("identity_type", "rackspace") | |
pyrax.set_credentials(USER, APIKEY) # Replace these or use a credential file | |
cf = pyrax.connect_to_cloudfiles(region="ORD") | |
containers = cf.get_all_containers() | |
total_bytes = sum(container.total_bytes for container in containers) | |
total_objects = sum(container.object_count for container in containers) | |
print("{} Containers".format(len(containers))) | |
print("Total Bytes: {}".format(humanize.naturalsize(total_bytes))) | |
print("Total Objects: {}".format(total_objects)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment