{"body":"import boto3\n\n\nclass DynamoDB(object):\n    def __init__(self):\n        client = boto3.resource('dynamodb')\n        self.table = client.Table('table_name')\n        self.primary_key = 'id'\n\n    def get_item(self, item):\n        try:\n            response = self.table.get_item(Key={self.primary_key: item})\n            return response['Item']\n        except:\n            raise Exception('Unable to retrieve item from DynamoDB table')\n\n    def put_item(self, item):\n        try:\n            self.table.put_item(Item=item)\n        except Exception as e:\n            raise Exception('Unable to update DynamoDB with item data')\n\n    def get_all_items(self):\n        try:\n            response = self.table.scan()\n            return response['Items']\n\n        except Exception as e:\n            raise Exception('Unable to retrieve DynamoDB data')\n","name":"","extension":"py","url":"https://www.irccloud.com/pastebin/8vPXewsW","modified":1559400052,"id":"8vPXewsW","size":838,"lines":29,"own_paste":false,"theme":"","date":1559400052}