added mail and password to cmd arguments (#7)

* added mail and password to cmd arguments

* fixed defaults
This commit is contained in:
Adrien
2020-11-29 19:20:50 +01:00
committed by GitHub
parent 85be9de562
commit 963d6a73cb
+8 -2
View File
@@ -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)})