import boto3

def get_table(name):
    dynamo = boto3.resource('dynamo')
    return dynamo.Table(name)

def get_object(reference):
    table = get_table('mediachain')
    obj = table.get_item(Key={'multihash': reference})
    byte_string = obj['Item']['data']

    if byte_string is None:
        raise KeyError('Could not find key <%s> in Dynamo'.format(reference))

    return cbor.loads(byte_string)

import boto3
import cbor

def get_table(name):
    dynamo = boto3.resource('dynamodb',
                            endpoint_url='http://localhost:8000',
                            region_name='us-east-1',
                            aws_access_key_id='',
                            aws_secret_access_key='')
    return dynamo.Table(name)

def get_object(reference):
    table = get_table('Mediachain')
    obj = table.get_item(Key={'multihash': reference})

    if obj is None:
        raise KeyError('Could not find key <%s> in Dynamo'.format(reference))

    byte_string = obj['Item']['data'].value
    return cbor.loads(byte_string)

Make get_object pull appropriate fields
Make get_object pull appropriate fields

Temporarily set up dynamo to work internally

  import boto3
+ import cbor
  
  def get_table(name):
-     dynamo = boto3.resource('dynamo')
+     dynamo = boto3.resource('dynamodb',
+                             endpoint_url='http://localhost:8000',
+                             region_name='us-east-1',
+                             aws_access_key_id='',
+                             aws_secret_access_key='')
      return dynamo.Table(name)
  
  def get_object(reference):
-     table = get_table('mediachain')
+     table = get_table('Mediachain')
      obj = table.get_item(Key={'multihash': reference})
-     byte_string = obj['Item']['data']
  
-     if byte_string is None:
+     if obj is None:
          raise KeyError('Could not find key <%s> in Dynamo'.format(reference))
  
+     byte_string = obj['Item']['data'].value
      return cbor.loads(byte_string)
  
Make get_object pull appropriate fields
## Code Before:
import boto3

def get_table(name):
    dynamo = boto3.resource('dynamo')
    return dynamo.Table(name)

def get_object(reference):
    table = get_table('mediachain')
    obj = table.get_item(Key={'multihash': reference})
    byte_string = obj['Item']['data']

    if byte_string is None:
        raise KeyError('Could not find key <%s> in Dynamo'.format(reference))

    return cbor.loads(byte_string)

## Instruction:
Make get_object pull appropriate fields
## Code After:
import boto3
import cbor

def get_table(name):
    dynamo = boto3.resource('dynamodb',
                            endpoint_url='http://localhost:8000',
                            region_name='us-east-1',
                            aws_access_key_id='',
                            aws_secret_access_key='')
    return dynamo.Table(name)

def get_object(reference):
    table = get_table('Mediachain')
    obj = table.get_item(Key={'multihash': reference})

    if obj is None:
        raise KeyError('Could not find key <%s> in Dynamo'.format(reference))

    byte_string = obj['Item']['data'].value
    return cbor.loads(byte_string)
