SMS and EMAIL with LDR


HELLO everyone i am writting a python code to receive an SMS and EMAIL on LDR as it cross the threshold value , but i am getting error in my python code

Please help me correct the python code

I have created a conf file and provided all credentials in it of Twilio and Mailgun

Above are the screnshoot of code and ERROR

Immediately edit the post and remove the third screenshot of the conf file.

Please help me with this

Try and import in this order -

import conf
from boltiot import Sms, Email, Bolt
import json, time

@akshayan.sinha , the order of importing modules in this case will be un-important because we are using all 03 module’s functionalities only after importing every library

Yes but I am getting error

Will it be possible to get SMS and Email in one Code

Did you separate importing the package and your file?

Are you here to solve a problem or argue with a fellow community?

By order, I was correcting the basic importance of importing modules in python.
Refer to PEP-8 for imports for validation.

Brother @akshayan.sinha , if correcting someone is arguing then I would love to do that again and again. No need to get offended. We all are here to solve queries.

Yes you can write a program to get both SMS and EMAIL.

can you help me write the code i am getting the error

@abutalahabelvadi , I have reviewed the code thoroughly. I have also made the project using Twilio and Mailgun’s service together.

As there is an error in the analogRead function’s value so I want you to once review the Hardware Configurations.
Make sure that one leg of the LDR is in the Ground port while the other leg of LDR is connected to one end of resistor. Connect the other end of the resistor in the A0 pin. Here is the diagram for the same:

You have imported in this manner -

import conf, json, time

Which could not import the json package in your program. That’s why it is not able to find the keyword ‘value’.

CORRECT method -

bro i have done the connection in the same but i am getting error in code please check the code

My dear, hardware configurations have nothing to do with the JSON script. Keywords like value and success are present in the JSON script.

yeah bro you are correct i have also done as u said but still the same
please check the code once again

Send the code screenshot again.

@abutalahabelvadi , in the config file make sure that every variable that is SID, AUTH_TOKEN, API_KEY and everything are in double quotes because yesterday I saw that in your config file there were single quotes around every variable. Try using double quotes and hope this problem vanishes :slight_smile:


Ok, now go to this answer and mark it as Solution. Other members will get to reach here for import related issue.

If you can change the title too, something like add 'import error’