I have got the items from AWS dynamodb as dict which has a value in binary format. I am not able to retrieve the value of a binary content.
Below is the sample.
my_details = {'route': Binary(b'gAAAABgLNW9tNcpeclIy1LSs8wKYRy9uMxgr5V4TwJmEJNZ2WVlb3Z3LtIK3PewO2SDRYkvXAh8bcZ4Ej_jBjaNi8xhU1-P2FLpcGEX2g='), 'way': '5064', '
stop': Binary(b'\xf1J\xef\xa0\xac\xb1A0\xa9\\:'), 'name': 'cfcf57'}
print(type(my_details['route']))
print(my_details['route'])
print(my_details['way'])
I need value of the route key like below
gAAAABgLNW9tNcpeclIy1LSs8wKYRy9uMxgr5V4TwJmEJNZ2WVlb3Z3LtIK3PewO2SDRYkvXAh8bcZ4Ej_jBjaNi8xhU1-P2FLpcGEX2g=
I have tried to get the value of route using mydetails['route'] but got below error
<class 'boto3.dynamodb.types.Binary'>
Traceback (most recent call last):
File "C:/Users/Prabhakar/Documents/Projects/Test.py", line 18, in <module>
print(my_details['route'])
TypeError: __str__ returned non-string (type bytes)
Please let me know how can I retrieve the binary content in python dict.