Created
January 25, 2012 22:00
-
-
Save anopheles/1679063 to your computer and use it in GitHub Desktop.
Bottle File Download
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os, sys, re | |
from threading import Thread | |
from bottle import route, run, debug, template, static_file, request, post, get, redirect | |
from PyQt4 import QtWebKit, QtGui, QtCore, QtNetwork | |
class DownloadServer(Thread): | |
def run(self): | |
debug() | |
filename = os.path.basename(datei_download) | |
folder = os.path.dirname(datei_download) | |
@route("/download/"+filename) | |
def download(): | |
return static_file(filename, root=folder) | |
run(host='localhost', port=8080) | |
if __name__ == "__main__": | |
app = QtCore.QCoreApplication(sys.argv) | |
datei_download = r"C:\Windows\notepad.exe" | |
download_server= DownloadServer() | |
download_server.start() | |
sys.exit(app.exec_()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment