Exemplo n.º 1
0
                    default=[5])
PARSER.add_argument("--ip",
                    nargs=1,
                    type=str,
                    metavar='IP',
                    help="IP to listen for incoming connections.",
                    default=["0.0.0.0"])
PARSER.add_argument("-p",
                    "--port",
                    nargs=1,
                    type=int,
                    metavar='PORT',
                    help="Port number to listen for incoming connections.",
                    default=[9000])
ARGS = PARSER.parse_args()
RSPET_API = rspet_server.API(ARGS.clients[0], ARGS.ip[0], ARGS.port[0])


def make_public_host(host, h_id):
    """Add full URI to host Dictionary"""
    new_host = host
    new_host['uri'] = url_for('get_host', host_id=h_id, _external=True)
    new_host['id'] = h_id
    return new_host


def make_public_help(command, hlp_sntx):
    """Add full URI to help Dictionary"""
    new_command = hlp_sntx
    new_command['uri'] = url_for('command_help',
                                 command=command,
Exemplo n.º 2
0
# TODO:
# There's a handful of commands there is no point whatsoever in executing through here
# so in lack of a better solution (that will come in following versions) lets' do this.
EXCLUDED_FUNCTIONS = ["help", "List_Sel_Hosts", "List_Hosts", "Choose_Host", "Select",\
                        "ALL", "Exit", "Quit"]

try:
    max_conns = int(argv[1])
except IndexError:
    max_conns = 5
except ValueError:
    print("Argument must be int! Exitting ...")
    sys.exit()

RSPET_API = rspet_server.API(max_conns)


def make_public_host(host, h_id):
    """Add full URI to host Dictionary"""
    new_host = host
    new_host['uri'] = url_for('get_host', host_id=h_id, _external=True)
    return new_host


def make_public_help(command, hlp_sntx):
    """Add full URI to help Dictionary"""
    new_command = hlp_sntx
    new_command['uri'] = url_for('command_help',
                                 command=command,
                                 _external=True)
Exemplo n.º 3
0
                    default=[5])
parser.add_argument("--ip",
                    nargs=1,
                    type=str,
                    metavar='IP',
                    help="IP to listen for incoming connections.",
                    default=["0.0.0.0"])
parser.add_argument("-p",
                    "--port",
                    nargs=1,
                    type=int,
                    metavar='PORT',
                    help="Port number to listen for incoming connections.",
                    default=[9000])
args = parser.parse_args()
RSPET_API = rspet_server.API(args.clients[0], args.ip[0], args.port[0])


def make_public_host(host, h_id):
    """Add full URI to host Dictionary"""
    new_host = host
    new_host['uri'] = url_for('get_host', host_id=h_id, _external=True)
    return new_host


def make_public_help(command, hlp_sntx):
    """Add full URI to help Dictionary"""
    new_command = hlp_sntx
    new_command['uri'] = url_for('command_help',
                                 command=command,
                                 _external=True)