Some part of your code is not visible in the screenshot.
Can you please copy paste the entire code instead of sharing the screenshot of the same?
from boltiot import Email, Bolt
import json, time
minimum_limit = 300 #the minimum threshold of light value
maximum_limit = 600 #the maximum threshold of light value
mybolt = Bolt(email_conf.API_KEY, email_conf.DEVICE_ID)
mailer = Email(email_conf.MAILGUN_API_KEY, email_conf.SANDBOX_URL, email_conf.SENDER_EMAIL, email_conf.RECIPIENT_EMAIL)
print (“Reading sensor value”)
response = mybolt.analogRead(‘A0’)
data = json.loads(response)
print ("Sensor value is: " + str(data[‘value’]))
sensor_value = int(data[‘value’])
if sensor_value > maximum_limit or sensor_value < minimum_limit:
print(“Making request to Mailgun to send an email”)
response = mailer.send_email(“Alert”, "The Current temperature sensor value is " +str(sensor_value))
response_text = json.loads(response.text)
print("Response received from Mailgun is: " + str(response_text[‘message’]))
except Exception as e:
print (“Error occured: Below are the details”)
here it is @yeshwant.naik
please help me to resolve my problem
If the indentation is right, then i guess there could be some error in the conf.py file u have written…
As far as the code, it seems right…
Refer this and check out once again.
but it is showing error in json function line.
@dixitupagyya23 Check if you have another file with the name json.py in the same directory as your program. Rename the json.py file and try again.
Actually there is an intendation error just be specific with python intendation and your code will run.
check the spelling of mailer.send_emaail in line 23 which is wrong that’s why error is occurring. And your problem is solved. That much you have to do mailer.send_email.
@dixitupagyya23 There’s a spelling mistake in your code. change your response line "response = mailer.send_email(“Alert”, “The Current temperature sensor value is " +str(sensor_value))”