def lookup_all_dictionaries_by_word(self, word): _FUNC_NAME_ = "lookup_all_dictionaries_by_word" # Setup connection and error logging connectionPool = urllib3.PoolManager(10, headers=SB_USER_AGENT) cdictall.lookup_word(connectionPool, SB_AUDIO_OUTPUT, SB_REPEAT_COUNT, SB_REPEAT_DELAY, word) # Close connection connectionPool.clear()
DICT_AUDIO_OUTPUT = 'Speaker' DICT_REPEAT_COUNT = 1 DICT_REPEAT_DELAY = 1.5 ################################################################ # Main Program ################################################################ # Process command line arguments argParser = argparse.ArgumentParser() argParser.add_argument("searchWord", type=str, help="is the word whose definition is to be looked up") argParser.add_argument("dictionary", type=str, nargs='?', help="is the dictionary source") args = argParser.parse_args() connectionPool = urllib3.PoolManager(10, headers=DICT_USER_AGENT) if args.dictionary is None: cdict.lookup_word(connectionPool, DICT_AUDIO_OUTPUT, DICT_REPEAT_COUNT, DICT_REPEAT_DELAY, args.searchWord) else: cdict.lookup_word(connectionPool, DICT_AUDIO_OUTPUT, DICT_REPEAT_COUNT, DICT_REPEAT_DELAY, args.searchWord, args.dictionary) connectionPool.clear() ######################################################################## # Debugging Commands ######################################################################## ''' cd $PROJ sudo python dictionary_lookup.py incorruptible sudo python dictionary_lookup.py incorruptible google '''