Ejemplo n.º 1
0
class GetConfig(object):
    """
    to get config from config.ini
    """
    def __init__(self):
        self.pwd = os.path.split(os.path.realpath(__file__))[0]
        self.config_path = os.path.join(
            os.path.split(self.pwd)[0], 'Config.ini')
        self.config_file = ConfigParse()
        self.config_file.read(self.config_path)

    @LazyProperty
    def db_type(self):
        return self.config_file.get('DB', 'type')

    @LazyProperty
    def db_name(self):
        return self.config_file.get('DB', 'name')

    @LazyProperty
    def db_host(self):
        return self.config_file.get('DB', 'host')

    @LazyProperty
    def db_port(self):
        return int(self.config_file.get('DB', 'port'))

    @LazyProperty
    def proxy_getter_functions(self):
        return self.config_file.options('ProxyGetter')
Ejemplo n.º 2
0
class GetConfig(object):
    """
    to get config from config.ini
    """

    def __init__(self):
        self.pwd = os.path.split(os.path.realpath(__file__))[0]
        self.config_path = os.path.join(os.path.split(self.pwd)[0], 'Config.ini')
        self.config_file = ConfigParse()
        self.config_file.read(self.config_path)


    @LazyProperty
    def proxy_getter_functions(self):
        return self.config_file.options('ProxyGetter')

    @LazyProperty
    def host_ip(self):
        return self.config_file.get('HOST','ip')

    @LazyProperty
    def host_port(self):
        return int(self.config_file.get('HOST', 'port'))

    @LazyProperty
    def mysql_url(self):
        return self.config_file.get('DB', 'MYSQL_URL')
Ejemplo n.º 3
0
class GetConfig(object):
    """
    to get config from config.ini
    """
    def __init__(self):
        self.pwd = os.path.split(os.path.realpath(__file__))[0]
        self.config_path = os.path.join(
            os.path.split(self.pwd)[0], 'Config.ini')
        self.config_file = ConfigParse()
        self.config_file.read(self.config_path)

    @LazyProperty
    def db_type(self):
        return self.config_file.get('DB', 'type')

    @LazyProperty
    def db_name(self):
        return self.config_file.get('DB', 'name')

    @LazyProperty
    def db_host(self):
        return self.config_file.get('DB', 'host')

    @LazyProperty
    def db_port(self):
        return int(self.config_file.get('DB', 'port'))

    @LazyProperty
    def db_mongodb_url(self):
        return self.config_file.get('DB', 'mongodb_url')

    # @LazyProperty
    # def db_password(self):
    #     try:
    #         password = self.config_file.get('DB', 'password')
    #     except Exception:
    #         password = None
    #     return password

    @LazyProperty
    def proxy_getter_functions(self):
        return self.config_file.options('ProxyGetter')

    @LazyProperty
    def host_ip(self):
        return self.config_file.get('API', 'ip')

    @LazyProperty
    def host_port(self):
        return int(self.config_file.get('API', 'port'))

    @LazyProperty
    def processes(self):
        return int(self.config_file.get('API', 'processes'))
Ejemplo n.º 4
0
class GetConfig(object):
    """
    to get config from config.ini
    """

    def __init__(self):
        self.pwd = os.path.split(os.path.realpath(__file__))[0]
        self.config_path = os.path.join(os.path.split(self.pwd)[0], 'Config.ini')
        self.config_file = ConfigParse()
        self.config_file.read(self.config_path)

    @LazyProperty
    def db_type(self):
        return self.config_file.get('DB', 'type')

    @LazyProperty
    def db_name(self):
        return self.config_file.get('DB', 'name')

    @LazyProperty
    def db_host(self):
        return self.config_file.get('DB', 'host')

    @LazyProperty
    def db_port(self):
        return int(self.config_file.get('DB', 'port'))

    @LazyProperty
    def proxy_getter_functions(self):
        return self.config_file.options('ProxyGetter')

    @LazyProperty
    def host_ip(self):
        return self.config_file.get('HOST','ip')

    @LazyProperty
    def host_port(self):
        return int(self.config_file.get('HOST', 'port'))
Ejemplo n.º 5
0
class GetConfig(object):
    """
    to get config from config.ini
    """

    def __init__(self):
        self.pwd = os.path.split(os.path.realpath(__file__))[0]
        config_dir = os.path.split(self.pwd)[0]
        self.config_path = os.path.join(config_dir, 'Config.ini')
        if not os.path.isfile(self.config_path):
            self.config_path = os.path.join(config_dir, 'Config.ini.default')
            
        self.config_file = ConfigParse()
        self.config_file.read(self.config_path)

    @LazyProperty
    def db_type(self):
        return self.config_file.get('DB', 'type')

    @LazyProperty
    def db_name(self):
        return self.config_file.get('DB', 'name')

    @LazyProperty
    def db_host(self):
        return self.config_file.get('DB', 'host')

    @LazyProperty
    def db_port(self):
        return int(self.config_file.get('DB', 'port'))

    @LazyProperty
    def db_password(self):
        try:
            password = self.config_file.get('DB', 'password')
        except Exception:
            password = None
        return password

    @LazyProperty
    def db_username(self):
        try:
            username = self.config_file.get('DB', 'username')
        except Exception:
            username = None
        return username

    @LazyProperty
    def log_level(self):
        try:
            log_level = self.config_file.get('LOG', 'level')
        except Exception:
            log_level = None
        return log_level

    @LazyProperty
    def proxy_getter_functions(self):
        return self.config_file.options('ProxyGetter')

    @LazyProperty
    def host_ip(self):
        return self.config_file.get('API','ip')

    @LazyProperty
    def host_port(self):
        return int(self.config_file.get('API', 'port'))

    @LazyProperty
    def processes(self):
        return int(self.config_file.get('API', 'processes'))