Created
March 8, 2017 10:11
-
-
Save clayg/5ab6001c13a733ae23b0fdf905af2a60 to your computer and use it in GitHub Desktop.
for poking at `python internal_list.py .expiring_objects`
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
import sys | |
from swift.common.internal_client import InternalClient | |
from swift.container.sync import ic_conf_body | |
from swift.common.wsgi import ConfigString | |
def main(): | |
try: | |
account = sys.argv[1] | |
except IndexError: | |
return 'ERROR: %s <account> [container] ' % sys.argv[0] | |
container = None | |
try: | |
container = sys.argv[2] | |
except IndexError: | |
pass | |
# print 'account', account | |
# print 'container', container | |
swift = InternalClient(ConfigString(ic_conf_body), 'test', 1) | |
if container: | |
listing = swift.iter_objects(account, container) | |
else: | |
listing = swift.iter_containers(account) | |
for item in listing: | |
print item['name'] | |
if __name__ == "__main__": | |
sys.exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment