Getting Value Error On executing the file

Hello Guys, can anyone help me I am getting a value error on running the python script which I am using to measure the value from the temperature sensor? Thank You

and below is the Code

@prajesh9921
Can you print the value of data just below the line where you assign the response to data? Make sure you are indenting the code correctly while making the changes.

Add
print(data)

Just after
data = json.loads(response)

Please share the output so that we can debug your issue.

While running your code, check whether your device is turned and it connected to BoLT cloud. This might be causes error to get the response from the cloud and thus attribute data might not be available.

Moreover, while editing your code, as python is an indentation oriented language, space and tab are considered different. If you are copying and pasting code from the portal. They are using space as indentation and you might be using tab for "try: " block. Just make sure you are uniform while using tab or space as an indent.

Hope this may help you out.

Hello
This is what I am getting after running the code


But this time I used a different code for the temp sensor where if temp crosses the threshold the led will turn on here also I am getting a “value error”.
code is given below,