Files
Status/status.py

22 lines
669 B
Python

import argparse
def parseArguments():
# Crear un objeto ArgumentParser
parser = argparse.ArgumentParser(description='Ejemplo de script con flags')
# Agregar los argumentos con sus respectivos flags
parser.add_argument('-w', '--web', action='store', dest='web', help='Indicar una web')
parser.add_argument('-h', '--host', action='store', dest='host', help='Indicar un host')
# Parsear los argumentos de la línea de comandos
args = parser.parse_args()
return args
if __name__ == '__main__':
args = parseArguments()
if args.web:
# Parte web, comprobar que Código devuelve
else:
# Parte host, hará ping