Commit inicial
This commit is contained in:
17
lib/argument_parser.py
Normal file
17
lib/argument_parser.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import argparse
|
||||
import getpass
|
||||
|
||||
def parse_arguments():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("clave", help="Clave ULSA argument")
|
||||
args = parser.parse_args()
|
||||
|
||||
clave = args.clave
|
||||
if not clave.startswith('al') or not clave[2:].isdigit() or len(clave) != 8:
|
||||
raise ValueError("Clave no válida. Debe comenzar con 'al' y tener 6 dígitos.")
|
||||
|
||||
contraseña = getpass.getpass("Contraseña: ")
|
||||
if not clave or not contraseña:
|
||||
raise ValueError("Clave y/o contraseña no válidos")
|
||||
|
||||
return clave, contraseña
|
||||
Reference in New Issue
Block a user