Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. symbols = ['aapl','vcr', 'tsla']
  2.  
  3. @app.route('/webhook', methods=['POST'])
  4. def webhook():
  5. if request.method == 'POST':
  6. # Parse the string data from tradingview into a python dict
  7. data = parse_webhook(request.get_data(as_text=True))
  8. if symbols[0] == data['symbol'] :
  9. print(' [Nooo] ')
  10. # Check that the key is correct
  11. if get_token() == data['key'] :
  12. print(' [Bouhhhh] ')
  13. print('caliceee', data)
  14. Popen([executable,'aapl.py'], creationflags=CREATE_NEW_CONSOLE)
  15. return '', 200
  16.  
  17. else:
  18. if symbols[1] == data['symbol'] :
  19. print(' [WE GOT IT ] ')
  20. # Check that the key is correct
  21. if get_token() == data['key'] :
  22. print(' [calice] ')
  23. print('kintoe', data)
  24. Popen([executable,'vcr.py'], creationflags=CREATE_NEW_CONSOLE)
  25. return '', 201
  26.  
  27.  
  28. else:
  29. if symbols[2] == data['symbol'] :
  30. print(' [castilla ] ')
  31. # Check that the key is correct
  32. if get_token() == data['key'] :
  33. print(' [chiwawa] ')
  34. print('holala', data)
  35. Popen([executable,'tsla.py'], creationflags=CREATE_NEW_CONSOLE)
  36. return '', 202
  37. else:
  38. abort(403)
  39.  
  40.  
  41.  
  42. if __name__ == '__main__':
  43. app.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement