Skip to content

Instantly share code, notes, and snippets.

@azizmb azizmb/rcloud_console.py
Last active Jan 4, 2016

Embed
What would you like to do?
Simple shell which initializes a connection to Rackspace CloudFiles
import argparse
import cloudfiles
from cloudfiles.connection import Connection
AUTH_URLS = ['uk_authurl', 'us_authurl']
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("rcloud_user", help="the rcloud user to use")
parser.add_argument("rcloud_key", help="the rcloud api key to use")
parser.add_argument("-s", "--servicenet", help="whether to use servicenet",
action="store_true")
parser.add_argument("-a", "--authurl", help="which authurl to use",
choices=AUTH_URLS, default=AUTH_URLS[0])
args = parser.parse_args()
con = Connection(
username=args.rcloud_user,
api_key=args.rcloud_key,
authurl=getattr(cloudfiles, args.authurl),
servicenet=args.servicenet
)
print 'Connection object is available as con'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.