twilio import Error with SSL
Posted: Mon Jan 29, 2018 2:03 am
Hello fellow Raspberry PI 3 users, I recently was assigned a assignment in my class using the following code:
I am using the python 3.4.2 idle and as I run it I get the following error: Import error No Twilio module found. Naturally I go sudo pip 3 install twilio upgrade as referenced on another thread on this forum but its telling me no Twilio package can be downloaded because no SSL/ TLS module is found. Please help. The Twilio version is 6.10.2.
Code: Select all
#detect_intruder_ldr.py
from gpiozero import LightSensor,Buzzer
from time import sleep
import twilio
import twilio.rest
from twilio.rest import Client
def main():
ACCOUNT_SID = "AC5545aca088a59032a7dda020858053b4"
AUTH_TOKEN = "612ef2b663ed8181b907435e3c4859b3"
ldr = LightSensor(4) # GPIO 4
buzzer = Buzzer(17) # GPIO17
message_sent= False
try:
while True:
sleep(0.2)
print("ldr.value " + str(ldr.value))
client = Client(ACCOUNT_SID,AUTH_TOKEN)
to_phone_number = " "# phone
from_phone_number = " " # twilio phone
body_message = "Intruder detected!" # message
if ldr.value < 0.9:
print("Light Blocked")
buzzer.on()
sleep(3)
buzzer.off()
if not message_sent:
client.messages.create(to=to_phone_number,
from_= from_phone_number,
body=body_message)
message_sent = True
#break
else:
print("No intruder")
except KeyboardInterrupt:
print("Exiting...")
finally:
ldr.close()
buzzer.close()
main()