Refactor webhdfs.py