Prevent JSON dumps error when dealing with complex types
This commit is contained in:
		
							parent
							
								
									3a46fd1054
								
							
						
					
					
						commit
						09de93412e
					
				@ -7,7 +7,7 @@ import base64
 | 
				
			|||||||
from boto3 import Session
 | 
					from boto3 import Session
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from moto.core import BaseBackend, BaseModel
 | 
					from moto.core import BaseBackend, BaseModel
 | 
				
			||||||
from moto.dynamodb2.models import dynamodb_backends
 | 
					from moto.dynamodb2.models import dynamodb_backends, DynamoJsonEncoder
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ShardIterator(BaseModel):
 | 
					class ShardIterator(BaseModel):
 | 
				
			||||||
@ -137,7 +137,7 @@ class DynamoDBStreamsBackend(BaseBackend):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def get_records(self, iterator_arn, limit):
 | 
					    def get_records(self, iterator_arn, limit):
 | 
				
			||||||
        shard_iterator = self.shard_iterators[iterator_arn]
 | 
					        shard_iterator = self.shard_iterators[iterator_arn]
 | 
				
			||||||
        return json.dumps(shard_iterator.get(limit))
 | 
					        return json.dumps(shard_iterator.get(limit), cls=DynamoJsonEncoder)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dynamodbstreams_backends = {}
 | 
					dynamodbstreams_backends = {}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user