I am using this Python project to try and interact with my Lego SBrick.
If I use the following piece of code (once connected to the SBrick):
json_response = client.rr_get_adc(sbrick_id='11:22:33:44:55:66', timeout=5)
I can then print the json_response to give me:
{"ret_code": 100, "temperature": 42.53253535, "voltage": 8.3954548125663}
I want to access the "ret_code" to check it equals 100 but if I try:
print (json_response["ret_code"])
I get this error:
TypeError: string indices must be integers
How can I pull the ret_code as an integer?