Hi,
I try to call my php send email script from another web server and calling from browser the email is sent.
Calling from python script on Raspberry Pi Jessie, this is not possible, error occure constantly while executing this response = urllib2.urlopen("http://www.mysite.info/sendemail.php?te ... mperature)).
Why? Someone have an idea?
My python code:
#!/usr/bin/python
import urllib2
import time
import sys
import os
import subprocess
while True:
try:
temperature_int = float(subprocess.check_output(["/opt/vc/bin/vcgencmd","measure_temp"]).replace("temp=","").replace("'C",""))
print temperature_int
if temperature_int >= 48:
#sendemail(temperature_int) # first i try to call function but nothing happens
print "sending email..."
response = urllib2.urlopen("http://www.mysite.info/sendemail.php?te ... mperature))
response.geturl()
else:
time.sleep(10) # Delay for 10 sec
except Exception as e:
print "error"
time.sleep(10) # Delay for 10 sec
def sendemail( temperature ):
print "sending email..."
response = urllib2.urlopen("http://www.mysite.info/sendemail.php?te ... mperature))
response.geturl()
time.sleep(10) # Delay for 10 sec