From 963d6a73cbea81bd7a1efc6e3823ab58adadb45d Mon Sep 17 00:00:00 2001 From: Adrien Date: Sun, 29 Nov 2020 19:20:50 +0100 Subject: [PATCH] added mail and password to cmd arguments (#7) * added mail and password to cmd arguments * fixed defaults --- server.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server.py b/server.py index fc12b64..a31bcab 100644 --- a/server.py +++ b/server.py @@ -78,6 +78,8 @@ def parse_args(): parser.add_argument("-d", "--debug", help="enable debug", const=10, default=20, nargs='?') parser.add_argument("-l", "--listen", help="change server listen address", default="127.0.0.1") parser.add_argument("-p", "--port", help="change server listen address", default="5000") + parser.add_argument("-m", "--mail", help="change the email address") + parser.add_argument("-P", "--password", help="change the password") parser.add_argument("--remote-disable",help="disable remote control") parser.parse_args() return parser @@ -97,8 +99,12 @@ if __name__ == "__main__": try: myp.manager._refresh_token() except OAuthError: - client_email = input("mypeugeot email: ") - client_paswword = input("mypeugeot password: ") + if args.mail and args.password: + client_email = args.mail + client_paswword = args.password + else: + client_email = input("mypeugeot email: ") + client_paswword = input("mypeugeot password: ") myp.connect(client_email, client_paswword) logger.info(myp.get_vehicles()) t1 = Thread(target=app.run,kwargs={"host":args.listen,"port":int(args.port)})