File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 42
42
43
43
44
44
def download_file (repo , filename ):
45
+ """
46
+ download_file fetches 'filename' from url 'repo' and
47
+ saves it in the current directory as file 'filename'.
48
+ """
45
49
try :
46
50
data = urllib2 .urlopen ("%s%s" % (repo , filename )).read ()
47
51
data = data .decode ("utf-8" )
@@ -54,6 +58,16 @@ def download_file(repo, filename):
54
58
55
59
56
60
def run (port = PORT , extensions = None ):
61
+ """
62
+ run starts a simple webserver on localhost serving the current directory.
63
+ Once started, it will open a tab on the default webbrowser and will continue
64
+ to serve until manually stopped.
65
+
66
+ :param port: server port
67
+ :param extensions: dictionary containing additional file extension - mime type
68
+ mappings the server should be aware of.
69
+ e.g. {'.xml': 'application/xml'}
70
+ """
57
71
handler = hs .SimpleHTTPRequestHandler
58
72
59
73
if extensions :
You can’t perform that action at this time.
0 commit comments