put_records () akzeptiert nur Schlüsselwortargumente in Kinesis boto3 Python API
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 = []
Dies ist mein Python-Skript zum Laden eines Arrays von JSON-Dateien nachkinesis stream wo ich 500 Datensätze kombiniere, um @ zu verwendput_records
Funktion. Aber ich erhalte einen Fehler:put_records() only accepts keyword arguments
. Wie übergebe ich einaufführe von Records zu dieser Methode? Jeder Datensatz ist ein json mit einem Partitionsschlüssel.
Sample Json:
[{
"air_date": "2004-12-31",
"answer": "FDDDe",
"category": "AACC",
"question": "'No. 2: 1912 Olympian; football star at Carlisle Indian School; 6 MLB seasons with the Reds, Giants & Braves'",
"round": "DDSSS!",
"show_number": "233",
"value": "$200"
}]