SHARE
TWEET

Untitled

a guest Jun 8th, 2017 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import paramiko
  2.  
  3. from flask import Flask, render_template
  4.  
  5. app = Flask(__name__)
  6.  
  7.  
  8. # -----CONFIG-------
  9. host = '16.10.155.2'
  10. user = 'bkc'
  11. secret = 'buvr2016'
  12. port = 30022
  13. # -----ENDCONFIG----
  14.  
  15.  
  16.  
  17. @app.route("/")
  18. def index():
  19.     return render_template('')  # в кавычках напиши название html файла
  20.  
  21.  
  22. @app.route("/process")
  23. def process():
  24.     client = paramiko.SSHClient()
  25.     client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  26.     client.connect(hostname=host, username=user, password=secret, port=port)
  27.     stdin, stdout, stderr = client.exec_command('vlc -vvv --play-and-exit /home/buvr/sirena8.mp3')
  28.     data = stdout.read() + stderr.read()
  29.     client.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top