Coverage for dakweb/dakwebserver.py: 0%
15 statements
« prev ^ index » next coverage.py v6.5.0, created at 2025-08-26 22:11 +0000
« prev ^ index » next coverage.py v6.5.0, created at 2025-08-26 22:11 +0000
1#! /usr/bin/env python3
3"""Main script to run the dakweb server and also
4to provide the list_paths and path_help functions
6@contact: Debian FTPMaster <ftpmaster@debian.org>
7@copyright: 2014 Mark Hymers <mhy@debian.org>
8@license: GNU General Public License version 2 or later
9"""
11import json
13import bottle
14from bottle import redirect
16from daklib.dbconn import DBConn
17from dakweb.webregister import QueryRegister
20@bottle.route("/")
21def root_path():
22 """Returns a useless welcome message"""
23 return json.dumps("Use the /list_paths path to list all available paths")
26QueryRegister().register_path("/", root_path)
29@bottle.route("/list_paths")
30def list_paths():
31 """Returns a list of available paths"""
32 redirect(
33 "https://ftp-team.pages.debian.net/dak/docs/generated/dakweb.html#module-dakweb"
34 )
37QueryRegister().register_path("/list_paths", list_paths)
40# Import our other methods
41from .queries import archive, binary, changelog, madison, source, suite # noqa: F401
43# Run the bottle if we're called directly
44if __name__ == "__main__":
45 # Set up our initial database connection
46 d = DBConn()
47 bottle.run()