File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4242
4343
4444def 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+ """
4549 try :
4650 data = urllib2 .urlopen ("%s%s" % (repo , filename )).read ()
4751 data = data .decode ("utf-8" )
@@ -54,6 +58,16 @@ def download_file(repo, filename):
5458
5559
5660def 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+ """
5771 handler = hs .SimpleHTTPRequestHandler
5872
5973 if extensions :
You can’t perform that action at this time.
0 commit comments