def __init__(self, remote=None, namenodes=None, **kwargs): self.remote = remote self.namenodes = namenodes or [] PyWebHdfsClient.__init__(self, **kwargs) if self.namenodes and 'path_to_hosts' not in kwargs: self.path_to_hosts = [('.*', self.namenodes)] # Override base uri self.base_uri_pattern = kwargs.get('base_uri_pattern', "http://{host}/webhdfs/v1/").format( host="{host}")
def connect(self, host: str = 'localhost', port: str = '50070', user: str = None, file_name: str = None): PyWebHdfsClient.__init__(self, host=host, port=port, user_name=user, timeout=1) self.create_file(file_name, None)
def __init__(self, remote=None, namenodes=None, **kwargs): self.remote = remote self.namenodes = namenodes or [] PyWebHdfsClient.__init__(self, **kwargs) if self.namenodes and 'path_to_hosts' not in kwargs: self.path_to_hosts = [('.*', self.namenodes)] # Override base uri self.base_uri_pattern = kwargs.get( 'base_uri_pattern', "http://{host}/webhdfs/v1/").format(host="{host}")