from __future__ import print_function # Python 2/3 compatibility
import boto3
import json
import decimal
#kinesis = boto3.resource('kinesis', region_name='eu-west-1')
client = boto3.client('kinesis')
with open("questions.json") as json_file:
questions = json.load(json_file)
Records = []
count = 0
for question in questions:
value1 = question['value']
if value1 is None:
value1 = '0'
record = { 'StreamName':'LoadtestKinesis', 'Data':b'question','PartitionKey':'value1' }
Records.append(record)
count +=1
if count == 500:
response = client.put_records(Records)
Records = []
Run Code Online (Sandbox Code Playgroud)
这是我的python脚本,用于将json文件数组加载到kinesis流中,在这里我将合并500条记录以使用put_recordsfunction。但我收到一个错误:put_records() only accepts keyword arguments。如何将记录列表传递给此方法?每个记录都是带有分区键的 …