So i am pretty new to Python Web servers and was following this question
How to setup a Raspberry Pi to receive webhooks
to receive a webhook from Ifttt in order to control my TV and AC but my server does't show any message from the Ifttt server. I have checked that my server is visible from the internet and i can trigger it using a proxy.
Python Code:
from flask import Flask
import subprocess
app = Flask(__name__)
tv_Power = "irsend SEND_ONCE TV KEY_POWER"
AC_On = "irsend SEND_ONCE AC on on on on on on"
AC_Off = "irsend SEND_ONCE AC off off off off off off off off off off off off off"
@app.route('/', methods = ['POST'])
def index():
return 'Choose Option'
@app.route('/tv_Power',methods=['POST'])
def pow():
process = subprocess.Popen(tv_Power.split(), stdout=subprocess.PIPE)
output, error = process.communicate()
return 'Changing TV State'
@app.route('/AC_On',methods=['POST'])
def acon():
process = subprocess.Popen(AC_On.split(), stdout=subprocess.PIPE)
output, error = process.communicate()
return 'Turning AC On'
@app.route('/AC_Off',methods=['POST'])
def acoff():
process = subprocess.Popen(AC_Off.split(), stdout=subprocess.PIPE)
output, error = process.communicate()
return 'Turning AC Off'
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0')
Ifttt webhook settings:
All of your routes are defined to be POST. Perhaps