Add a command to specifically test authentication.
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user