import boto3
import json


# use Reource
def put_hehe(name, year, dynamodb=None):
    if not dynamodb:
        dynamodb = boto3.resource('dynamodb')

    table = dynamodb.Table('hehe')
    response = table.put_item(
       Item={
            'name': name,
            'year': year,
            }
    )
    return response

# use Client
def put_ddb(name,alias):
    ddb= boto3.client('dynamodb')
    tableName = 'hehe'
    item = {  'name': {'S': name},
              'alias': {'S': alias}
           }
    ddb.put_item(TableName = tableName, Item = item)


if __name__ == '__main__':
    movie_resp = put_hehe('cxy','8848')
    print("Put movie succeeded:")


