from aishu.datafaker.anyrobot.getSqlVaule import AnyRobotDataServer
from aishu.datafaker.profession.getFiledValue import filed
from aishu import setting

class faker():
    def __init__(self,host,port,user,password,database):
        self.host = host
        self.port = port
        self.user = user
        self.password = password
        self.database = database
        setting.host = self.host
        setting.port = self.port
        setting.user = self.user
        setting.password = self.password
        setting.database = self.database

    def route(self,key,result=[]):
        date = AnyRobotDataServer(key).getValue()
        if isinstance(date, bool):
            date = filed(key, result)
            return date
        else:
            return date

if __name__ == '__main__':
    host = '192.168.84.26'
    key1 = 's_id'
    port = 30006
    user = 'root'
    password = 'eisoo.com'
    database = 'AnyRobot'
    date1 = faker(host,port,user,password,database).route(key1)
    print(date1)