Created
December 24, 2017 09:34
-
-
Save behconsci/825a34971f20e2b350e39fcca8b85fbe to your computer and use it in GitHub Desktop.
AWS Class with aws services
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
class AWS(object): | |
def __init__(self): | |
self.aws_session = boto3.Session( | |
aws_access_key_id=settings.AWS_ACCESS_KEY, | |
aws_secret_access_key=settings.AWS_SECRET_KEY, | |
region_name='eu-central-1' | |
) # todo: offload these credentials to external locations e.g. OS Keychain | |
def dynamo_db_table(self, table_name=None): | |
if table_name: | |
db = self.aws_session.resource('dynamodb') | |
return db.Table(table_name) | |
warnings.warn('Please give table_name', UserWarning) | |
def iot(self): | |
return self.aws_session.resource('iot') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment