def kit_start(self, pw=None, controller=Controller()): print('kit_setup') print(pw) #controller = self.controller #controller = Controller() # Handle SIGNIT and close the controller. def signal_handler(sig, frame): info('main', 'sigint') controller.stop() time.sleep(1) print 'Goodbye.' sys.exit(0) signal.signal(signal.SIGINT, signal_handler) # Load the configuration dictionary. print 'info:main: loading .env file' env.load('.env') # Setup our controller object and start it. controller.setup(pw) controller.start() # Wait for SIGINT. signal.pause() return 0
print('Mailbox Number: ' + str(box)) info('send', 'STATUS') packet = bytearray(config.OP_STATUS_SIZE) packet[0] = config.OP_STATUS packet[1:9] = crypto.get_checksum(packet) packet[9] = 1 packet[10] = 1 packet[11] = 1 packet[12] = 1 lora.send(packet) info('send', 'ACK {}'.format(lora.packet_str(packet))) if __name__ == '__main__': boxNum = int(sys.argv[1]) setup(boxNum) looping = True try: env.load(envPath) subscribe(fn=handle, channel='inbound') #subscribe(fn=handle, channel=get_topic()) while looping: get_message() loop() except KeyboardInterrupt: looping = False destroy()
def get_env(self): print 'info:main: loading .env file' env.load('.env')
import kit.env as env from kit.logger import error, info # Define the controller. controller = Controller() # Handle SIGNIT and close the controller. def signal_handler(sig, frame): info('main', 'sigint') controller.stop() time.sleep(1) print 'Goodbye.' sys.exit(0) # Main! if __name__ == '__main__': signal.signal(signal.SIGINT, signal_handler) # Load the configuration dictionary. print 'info:main: loading .env file' env.load('.env') # Setup our controller object and start it. controller.setup() controller.start() # Wait for SIGINT. signal.pause()
time.sleep(0.1) unsubscribe() if __name__ == '__main__': queue = Queue() thread = Thread(target=thread_run, args=(queue, )) try: _password = getpass('Please provide your password: '******'Password not provided!') # Load the environment variables. load(envPath) # Try to verify the password by decrypting the secret # data. If it encounters and error then an exception # will be raised and the script will quit. try: data = read_file(path=os.environ['KIT_SECRET_PATH']) decrypt(data, _password) except: raise Exception( 'Decryption of secret data failed, password incorrect!') # Start our message thread. thread.start() print 'Program is starting ... '