0

On a server, I have some files that are generated hourly. Users in the UK will need access to these files. The problem is that I do not want to give them SSH or VPN access. Instead, I am trying to create a web application that will accomplish this task. So, I have decided to use flask.

So, which modules should I use that can accomplish this task. My requirement is to fetch the information from the server through ssh, and then allow user to download that information from the flask application.

davidism
  • 121,510
  • 29
  • 395
  • 339
fear_matrix
  • 4,912
  • 10
  • 44
  • 65
  • As much as I love flask, what about the old skool solution of Apache + rsync? You could rsync the files over via SSH into Apache's web directory. Apache would give you a very basic index page and the ability to download files. You could put it under HTTPS and password-protect it. – Rachel Sanders Dec 05 '12 at 23:12

1 Answers1

0

Take a look at

You can use the subprocess module to download a file with an external program. You can use sched to schedule the event at some future time, though it's probably better to setup a cron script for fetching the files. You should look for resources online.

In your case, you can use scp host@server:remotepath localpath to fetch the script. Something like

import subprocess

subprocess.call(["scp", "host@server:remotepath", "localpath"])
print (open("localpath").read())
Ehtesh Choudhury
  • 7,452
  • 5
  • 42
  • 48