def search_zone(question, zone): origin = zone["origin"] class_ = zone["class"] records = [] for record in zone["RR"]: # Replace @ symbol in record if record["name"] == '@': record["name"] = origin if utilities.match(question, record): records.append(record) return (records, class_)
# If there are no arguments if len(sys.argv) == 1: print "\r\n" parser.print_help(sys.stderr) sys.exit(1) else: args = parser.parse_args() try: print "Reconfiguring XBEE Serial settings..." ser = serial.Serial() ser.port = '/dev/' + args.port ser.baudrate = args.oldbaud.split(',')[0] ser.bytesize = match(args.oldbaud.split(',')[1]) ser.parity = match(args.oldbaud.split(',')[2]) ser.stopbits = match(args.oldbaud.split(',')[3]) ser.close() ser.open() if args.api != True: send(ser, '+++') receive(ser) send(ser, 'ATBD={0}\r'.format(bamatch(args.newbaud.split(',')[0]))) receive(ser) send(ser, 'ATNB={0}\r'.format(pamatch(args.newbaud.split(',')[2]))) receive(ser)