def mainstart(self): bucle = True while bucle: try: option = int(input("Digita la opción que desees ejecutar: ")) print() if option == 1: Clients().start() self.menu() elif option == 2: Vehicles().start() self.menu() elif option == 3: Service().start() self.menu() elif option == 4: Facturas().get_all() self.menu() elif option == 5: Facturas().hola() self.menu() elif option == 6: self.menu() elif option == 7: bucle = False print() except NameError: print(NameError) print("7. Mostrar menú de modulos [7]") print( "La opción digitada es invalida (debe ser un número en el menú)." ) print()
def __init__(self): self.queue = Queue() self.lc = LockContainer(self.queue) self.lc.setDaemon(True) self.lc.start() self.lg = LockSeverDiag(self.lc) self.lg.setDaemon(True) self.lg.start() self.clients = Clients(self.queue) self.clients.setDaemon(True) self.clients.start()
def main(): init_logging('/tmp/lockserver.log') ebus = eventbus() clients = Clients(ebus) clients.setDaemon(True) clients.start() lc = LockContainer(ebus) ebus.register_consumer(lc, common.LOCKOP_TOPIC) ebus.register_consumer(lc, common.UNREGISTER_TOPIC) ebus.register_consumer(clients, common.RESPONSE_TOPIC) f = DistComFactory(ebus) f.protocol = DistLockComm reactor.listenTCP(8000, f) reactor.run()
SA_SERVICE_PORT = 5000 TM_SERVICE_HOST = os.environ.get('TM_SERVICE_HOST', 'localhost') TM_SERVICE_PORT = 5001 MONGODB_HOST = os.environ.get('MONGODB_HOST', 'localhost') MONGODB_PORT = 27017 MONGODB_DATABASE = os.environ.get('MONGODB_DATABASE', 'tmdata') print('SA_SERVICE_HOST: {}'.format(SA_SERVICE_HOST)) print('SA_SERVICE_PORT: {}'.format(SA_SERVICE_PORT)) print('TM_SERVICE_HOST: {}'.format(TM_SERVICE_HOST)) print('TM_SERVICE_PORT: {}'.format(TM_SERVICE_PORT)) print('MONGODB_HOST: {}'.format(MONGODB_HOST)) print('MONGODB_PORT: {}'.format(MONGODB_PORT)) db = DBWorker(MONGODB_HOST, MONGODB_PORT, 'taskmaster') clients = Clients(db) startTime = datetime.now() tm = ThematicModeller(host=TM_SERVICE_HOST, port=TM_SERVICE_PORT) sa = SentimentalAnalyzer(host=SA_SERVICE_HOST, port=SA_SERVICE_PORT) # using dict of required fields and their types to validate request def check_request(request, fields): errors = [] if not request.json: errors.append('No JSON sent. ' + 'Did you forget to set Content-Type header' + ' to application/json?') return errors
def display(): print( "=============================>Networker Ver 1.0<===========================" ) print() print("-c => client") print("-s => server") print("-TCP => establish a TCP client or server") print("-UDP => establish a UDP client or server") print( "--basic => Basic type of server of client which sends and receives the packets" ) print("--type=cat => Bit advanced to the --basic mode") def about(): print( """=============================>Networker Ver 1.0<=========================== Networker the Network Bozooka Programmed by Visweswaran Product of India A standard all in 1 tool for performing pen-testing in an environment where other packages failed Do not worry if other tools aren't there now for you got a Bazooka with you""" ) clients = Clients() servers = Servers()
def run(): clients = Clients() clients._load_clients() while True: command = str(input(''' Bienvenido, a BanPlatzi tu app de gestion de filas de tu banco [A]Agregar cliente a fila de deposito [B]Agregar cliente a fila de apertura de cuenta [C]Atender cliente [D]Listar clientes en fila [S]Salir ''')).lower() if command == 'a': depositor_name = _get_input_data('nombre del depositante') depositor_uid = _get_input_data('numero de identificaion del depositante') number_account = _get_input_data('numero de cuenta del cliente') found_account = clients.search(number_account) if found_account: add_to_deposit_queue(number_account, depositor_name, depositor_uid) else: print(f'La cuenta numero {number_account}, no fue encontrada') elif command == 'b': name = _get_input_data('nombre del cliente') identification = _get_input_data('identificacion de cliente') add_to_opening_account_queue(name, identification) elif command == 'c': queue = input(''' Elije que fila deseas atender : [A] Fila de Depositos [B] Fila de Apertura de Cuenta ''').lower() print('Siguiente Cliente...') if queue == 'a': try: print('Cliente a atender >> Nombre del depositante: {} - Identificado con C.C N° {} | Numero de cuenta a depositar: {}'.format(deposit_queue[0]['depositor_name'], deposit_queue[0]['depositor_uid'], deposit_queue[0]['number_account'])) value = _get_input_data('monto a consignar, no incluyas puntos ni comas - $ ') client = clients.search(deposit_queue[0]['number_account']) clients.deposit(client, value) deposit_queue.popleft() except IndexError: print('La fila de Depositos no tiene clientes') elif queue == 'b': try: print('Cliente a atender >> Nombre del futuro cliente: {} - Identificado con C.C N° {}'.format(account_opening_queue[0]['name'], account_opening_queue[0]['identification'])) number_phone = _get_input_data('numero de telefono del cliente: ') email = _get_input_data('email del cliente: ') clients.add(account_opening_queue[0]['name'], account_opening_queue[0]['identification'], number_phone, email) account_opening_queue.popleft() except IndexError: print('La fila de Apertura de clientes no tiene clientes') elif command == 'd': list_clients_queues() elif command == 's': print('Saliendo...') sys.exit() else: print('Comando invalido, vuelve a intentar.')
import time from clients import Clients, Crandom # curl -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d "{\"task\":\"Read a book\"}" http://127.0.0.1:5000/api/v1/testing start = True clc = 1 api_url = 'http://127.0.0.1:5000/api/v1/auth/signin' # api_url = 'http://127.0.0.1:5000/api/v1/auth/signup' clientsList = [] json = {'type': "simple", 'user': "******", 'pswd': "q"} for count in range(clc): x = Clients(count, api_url, json) clientsList.append(x) while start: for client in clientsList: Crandom(client).client_run() print("---" * 20) time.sleep(2)
#PREPROCESSOR AM-CTAC #Script for the preprocesing of URLs from tickets for the Analizer Module #____________________________________________________________________________ #____________________________________________________________________________ #Configuration: # #The unique parameter that have to be configured is the hours, that represents #the interval of time in that the script is executed. # #_____________________________________________________________________________ from clients import Clients from tickets import Tickets from ticketspaths import Ticketpaths from paths import Paths # unique parameter #Tables | #ticketpaths V ticpaths = Ticketpaths(Clients(),Tickets(8)) paths=Paths(ticpaths) #Client_score and recurrence paths.paths_recurrence() paths.paths_client_score() #insert_data #ticketpaths ticpaths.tp_insert_data() #paths paths.paths_insert_data()