Skip to content

Instantly share code, notes, and snippets.

@clayg
Created March 8, 2017 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clayg/5ab6001c13a733ae23b0fdf905af2a60 to your computer and use it in GitHub Desktop.
Save clayg/5ab6001c13a733ae23b0fdf905af2a60 to your computer and use it in GitHub Desktop.
for poking at `python internal_list.py .expiring_objects`
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