#NEWLINE# def load_credentials( self , profile ) : #NEWLINE# #INDENT# '\n        Loads crentials for a given profile. Profiles are stored in\n        ~/.db.py_s3_{profile_name} and are a base64 encoded JSON file. This is\n        not to say this a secure way to store sensitive data, but it will\n        probably stop your little sister from spinning up EC2 instances.\n\n        Parameters\n        ----------\n        profile: str\n            identifier/name for your database (i.e. "dev", "prod")\n        ' #NEWLINE# f = profile_path ( S3_PROFILE_ID , profile ) #NEWLINE# if os . path . exists ( f ) : #NEWLINE# #INDENT# creds = json . loads ( base64 . decodestring ( open ( f , 'rb' ) . read ( ) ) . encode ( 'utf-8' ) ) #NEWLINE# if ( 'access_key' not in creds ) : #NEWLINE# #INDENT# raise Exception ( "`access_key` not found in s3 profile '{0}'" . format ( profile ) ) #NEWLINE# #UNINDENT# self . access_key = creds [ 'access_key' ] #NEWLINE# if ( 'access_key' not in creds ) : #NEWLINE# #INDENT# raise Exception ( "`secret_key` not found in s3 profile '{0}'" . format ( profile ) ) #NEWLINE# #UNINDENT# self . secret_key = creds [ 'secret_key' ]