Project 10 line 1 column 1 error

I have used after declaring response Json to load response as mentioned it the project

Make the changes accordingly. I ran this

1 Like

Remove the the below line from your code

response_text = json.loads(response.text)
print("Response received from Mailgun is: " + str(response_text['message']))

and directly print the response without doing json.loads()

print ("Mailgun response is " + response.text)

Yes this is working now…it’s no error…
For getting email I have to run it continously na?

Print the credentials before passing to mail. Check the below snippet

while True:
    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))
            print ("Mailgun response is " + response.text)
    except Exception as e:
        print ("Error occured: Below are the details")
        print (e)

When conditions are met, you will receive the email. Yes. The program has to keep running.

Yes. Glad I helped you :slight_smile:


Yes condition are always meeting…

Change the min and max constraints so that they can’t be fulfilled

1 Like

Yes code is all good now…now just waiting to get email bcz condition are fulfilling

@akshayan.sinha Thankuu

Check your spam folder, you already have loads of email there.

Yes not yet…m sitting near refrigerator so that it can be cooled…:sweat_smile:


@swastishree10 forcefully terminate the program and then change the constraints so that everytime you get am email

Yes but conditions are always satisfying so email should be sent…

Make sure that you have entered valid email address in the config file which was used in Mailgun while registering is correct…it is same as there

In your email inbox, check the spam/junk folder. All the emails will be visible there. I mentioned it already.

Yes I am checking continuously…there

Do u know if I can check on mailgun ?