diff --git a/moto/kinesis/models.py b/moto/kinesis/models.py index 0a3eef3c..6a1b081f 100644 --- a/moto/kinesis/models.py +++ b/moto/kinesis/models.py @@ -56,7 +56,7 @@ class Shard(object): return sequence_number def get_max_sequence_number(self): - return self.records.keys()[-1] + return list(self.records.keys())[-1] def to_json(self): return { @@ -81,7 +81,7 @@ class Stream(object): self.shards = {} for index in range(shard_count): - shard_id = "shardId-{}".format(str(index).zfill(12)) + shard_id = "shardId-{0}".format(str(index).zfill(12)) self.shards[shard_id] = Shard(shard_id) @property @@ -100,7 +100,7 @@ class Stream(object): def get_shard_for_key(self, partition_key): # TODO implement sharding - shard = self.shards.values()[0] + shard = list(self.shards.values())[0] return shard def put_record(self, partition_key, explicit_hash_key, sequence_number_for_ordering, data): diff --git a/moto/kinesis/utils.py b/moto/kinesis/utils.py index c998fe29..0d35b413 100644 --- a/moto/kinesis/utils.py +++ b/moto/kinesis/utils.py @@ -23,9 +23,9 @@ def compose_shard_iterator(stream_name, shard, last_sequence_id): stream_name, shard.shard_id, last_sequence_id, - ) - ) + ).encode("utf-8") + ).decode("utf-8") def decompose_shard_iterator(shard_iterator): - return base64.decodestring(shard_iterator).split(":") + return base64.decodestring(shard_iterator.encode("utf-8")).decode("utf-8").split(":")