lms .cli .server .identify
Attempt to identify the backend of the target server.
usage: python3 -m lms.cli.server.identify [-h] [--version] [--server SERVER]
[--server-type {blackboard,canvas,moodle}]
[--auth-user AUTH_USER]
[--auth-password AUTH_PASSWORD]
[--auth-token AUTH_TOKEN]
Attempt to identify the backend of the target server.
options:
-h, --help show this help message and exit
--version show program's version number and exit
server options:
--server SERVER The address of the LMS server to connect to.
--server-type {blackboard,canvas,moodle}
The type of LMS being connected to (this can normally
be guessed from the server address).
authentication options:
--auth-user AUTH_USER
The user to authenticate with.
--auth-password AUTH_PASSWORD
The password to authenticate with.
--auth-token AUTH_TOKEN
The token to authenticate with.
1""" 2Attempt to identify the backend of the target server. 3""" 4 5import argparse 6import sys 7 8import lms 9import lms.backend.instance 10import lms.cli.parser 11 12def run_cli(args: argparse.Namespace) -> int: 13 """ Run the CLI. """ 14 15 config = args._config 16 17 backend_type = lms.backend.instance.guess_backend_type(**config) 18 if (backend_type is None): 19 print(f"ERROR: Unable to determine backend type from server '{config.get('server', '')}'.") 20 return 1 21 22 print(backend_type) 23 return 0 24 25def main() -> int: 26 """ Get a parser, parse the args, and call run. """ 27 return run_cli(_get_parser().parse_args()) 28 29def _get_parser() -> argparse.ArgumentParser: 30 """ Get the parser. """ 31 32 return lms.cli.parser.get_parser(__doc__.strip()) 33 34if (__name__ == '__main__'): 35 sys.exit(main())
def
run_cli(args: argparse.Namespace) -> int:
13def run_cli(args: argparse.Namespace) -> int: 14 """ Run the CLI. """ 15 16 config = args._config 17 18 backend_type = lms.backend.instance.guess_backend_type(**config) 19 if (backend_type is None): 20 print(f"ERROR: Unable to determine backend type from server '{config.get('server', '')}'.") 21 return 1 22 23 print(backend_type) 24 return 0
Run the CLI.
def
main() -> int:
26def main() -> int: 27 """ Get a parser, parse the args, and call run. """ 28 return run_cli(_get_parser().parse_args())
Get a parser, parse the args, and call run.