Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- symbols = ['aapl','vcr', 'tsla']
- @app.route('/webhook', methods=['POST'])
- def webhook():
- if request.method == 'POST':
- # Parse the string data from tradingview into a python dict
- data = parse_webhook(request.get_data(as_text=True))
- if symbols[0] == data['symbol'] :
- print(' [Nooo] ')
- # Check that the key is correct
- if get_token() == data['key'] :
- print(' [Bouhhhh] ')
- print('caliceee', data)
- Popen([executable,'aapl.py'], creationflags=CREATE_NEW_CONSOLE)
- return '', 200
- else:
- if symbols[1] == data['symbol'] :
- print(' [WE GOT IT ] ')
- # Check that the key is correct
- if get_token() == data['key'] :
- print(' [calice] ')
- print('kintoe', data)
- Popen([executable,'vcr.py'], creationflags=CREATE_NEW_CONSOLE)
- return '', 201
- else:
- if symbols[2] == data['symbol'] :
- print(' [castilla ] ')
- # Check that the key is correct
- if get_token() == data['key'] :
- print(' [chiwawa] ')
- print('holala', data)
- Popen([executable,'tsla.py'], creationflags=CREATE_NEW_CONSOLE)
- return '', 202
- else:
- abort(403)
- if __name__ == '__main__':
- app.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement