Twilio Problem in Code

I’m running everything in Command Prompt in Windows rather than Terminal in Linux, everything is working fine but I got this error when I used the code that sends message for crossing threshold:

AttributeError: module ‘conf’ has no attribute ‘SID’

Hi @kartikeysingh.51,

We may not be able to help you, as you have not followed the instructions given in the course.

However, if you could share a screenshot of the issue, we might just be able to help you out.

Hi, @kartikeysingh.51
Try these codes :

#API_KEY,This is your Bolt Cloud account API key
API_KEY = 'your api-key'
#DEVICE_ID,This is the ID of your Bolt device
DEVICE_ID = 'your device-id'
#You can find SID in your Twilio Dashboard
SID = 'twilio api-key'      
#You can find  on your Twilio Dashboard
AUTH_TOKEN = 'twilio auth-key' 
#This is the no. generated by Twilio. You can find this on your Twilio Dashboard
FROM_NUMBER = 'from number'
#This is your number. Make sure you are adding +91 in beginning
TO_NUMBER = '+91 to number'

import conf
from boltiot import Bolt, Sms, Email
import requests # for making HTTP requests
import json # library for handling JSON data
import time # module for sleep operation

minimum_limit = 235
maximum_limit = 238

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

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 Twilio to send a SMS")
            response = sms.send_sms("The Current temperature sensor value is " +str((100*sensor_value)/1024) + " degree celsious")
            print("Response received from Twilio is: " + str(response))
            print("Status of SMS at Twilio is :" + str(response.status))
    except Exception as e: 
        print ("Error occured: Below are the details")
        print (e)

Hope this will solve your problem.

Hello,the problem is in the file of the project.Login to your twilio account and in the twilio dashboard you will find something like ACCOUNT SID that is the SID that you have to enter in the file and the AUTH_TOKEN is right below it as shown in the screen shot bellow…make sure you enter them correctly without any mistake.

Kartikeysingh 51
just replace the SID attribute to SID of twilio account in file . It will solve your problem if not please notify the other error.

Hey , make sure the SID value you have entered matches exactly with your twilio account SID and make sure the syntax is right. Hope this solves your problem.