Add a command to specifically test authentication.

This commit is contained in:
Frédéric Tronel
2025-08-27 14:52:25 +02:00
parent ff65ebdc16
commit 4803711f44

View File

@@ -205,6 +205,7 @@ def main():
parser.add_argument("-p", "--password", dest='password', nargs='?', required=False, default=None, help="Password.")
parser.add_argument("-d", "--debug", dest='debug', action='store_true', required=False, help="Activate debug.")
subparsers = parser.add_subparsers(title='subcommands', dest='command', help='subcommand help')
parserauth = subparsers.add_parser('A', help='Test authentication.')
parserlist = subparsers.add_parser('L', help='List all possible reservations types.')
parserdump = subparsers.add_parser('D', help='Dump all reservation of some kind')
parserdump.add_argument("-i", "--index", dest='index', type=int, required=True, help="Index of reservations to dump.")
@@ -256,11 +257,14 @@ def main():
# Authentication
mainpage, cookies = authenticate(baseURL, args.city, args.login, args.password)
if (args.command == None) or (args.command == 'A'):
exit(0)
# Switch between commands
logger.info('Retrieve reservation kinds')
resaTypes = getReservationsKind(baseURL, mainpage, cookies)
if (args.command == None) or (args.command == 'L'):
if (args.command == 'L'):
resaNum = 1
for resaType in resaTypes.keys():
print("%d - %s" % (resaNum, resaType))