Regarding Temperatue Project using e-mail


#1

I generated the following code and it is showing following error. please help me fix it.

This is the code

This is the error
Screenshot%20from%202019-07-01%2021-36-26

Here it is showing error: line 1 column 1 something


#2

Hi @ksengar100,

To find out the exact issue, comment two lines after calling the send_sms function and directly print the response from the mailgun.

while True:
    print ("Reading sensor value")
    response = mybolt.analogRead('A0')
    data = json.loads(response)
    print ("Sensor value is: " + str(data['value']))
    try:
        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 ("Respose recieved from the mailgun is" + str(response_text['messae']))
            print ("Mailgun response is " + response.text)
    except Exception as e:
        print ("Error occured: Below are the details")
        print (e)
    time.sleep(10)

Also check if this thread helps Mailgun Error-Expecting value:line 1 column 1 (char 0)

Do let me know in case you need further assistance.