Error in code of,Sending an SMS when Temperature Crosses Threshold!


#1

Hi Sir,

found indentation errors in the code, the actual code mentioned in the course is as below:
import conf
from boltiot import Sms, Bolt
import json, time

minimum_limit = 300
maximum_limit = 600

mybolt = Bolt(conf.API_KEY, conf.DEVICE_ID)
sms = Sms(conf.SSID, conf.AUTH_TOKEN, conf.TO_NUMBER, conf.FROM_NUMBER)

while True:
response = mybolt.analogRead(‘A0’)
data = json.loads(response)
print (data[‘value’])
try:
sensor_value = int(data[‘value’])
print (sensor_value)
if sensor_value > maximum_limit or sensor_value < minimum_limit:
response = sms.send_sms("The Current temperature sensor value is " +str(sensor_value))
except Exception as e:
print (“Error”,e)
time.sleep(10)

so the code which i have writen in VMware,im getting this error as shown in below image:

Please do guide me, also wanted to rectify if the credentials put are proper like API_key n remaining.


#2

@pednekarruchika I believe this is the same error as I had mentioned in your previous post.