modules/DICT.py
changeset 33 adf562e77977
parent 32 dcb1b0459f1c
child 34 535d03a56f9d
equal deleted inserted replaced
32:dcb1b0459f1c 33:adf562e77977
    17 
    17 
    18     def __init__(self, server, port = 2628, identify = 1):
    18     def __init__(self, server, port = 2628, identify = 1):
    19         self._server = server
    19         self._server = server
    20         self._port = port
    20         self._port = port
    21         self._conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    21         self._conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    22         self._conn.connect((socket.gethostbyname(self._server),
    22         self._conn.connect((socket.gethostbyname(self._server), self._port))
    23                               self._port))
       
    24         self._conn.recv(1024) # eat welcome message
    23         self._conn.recv(1024) # eat welcome message
    25 
    24 
    26 #          if identify:
    25 #        if identify:
    27 #              self._send("CLIENT dict.py/0.00", 1)
    26 #            self._send("CLIENT dict.py/0.00", 1)
    28 
    27 
    29     def get_databases(self):
    28     def get_databases(self):
    30         return map(split_and_remove_quotes,
    29         return map(split_and_remove_quotes,
    31                    self._interpret_multiline(self._send("SHOW DATABASES")))
    30                    self._interpret_multiline(self._send("SHOW DATABASES")))
    32 
    31 
   110     #pprint(dict.get_database_info(word))
   109     #pprint(dict.get_database_info(word))
   111     #pprint(dict.get_databases())
   110     #pprint(dict.get_databases())
   112     #pprint(dict.get_strategies())
   111     #pprint(dict.get_strategies())
   113     pprint(dict.get_definition(word))
   112     pprint(dict.get_definition(word))
   114     #pprint(dict.get_words(word))
   113     #pprint(dict.get_words(word))
       
   114 
       
   115 # vim:set et sts=4: