Skip to main content

webhdfspy

A Python wrapper library to access the Hadoop WebHDFS REST API.

Installation

pip install webhdfspy

Python versions

webhdfspy requires Python 3.9+

Usage

import webhdfspy

# Basic usage
client = webhdfspy.WebHDFSClient("localhost", 50070, "username")
print(client.listdir("/"))
client.mkdir("/foo")
client.create("/foo/foo.txt", "just put some text here", overwrite=True)
print(client.open("/foo/foo.txt"))
client.remove("/foo", recursive=True)
client.close()

# Context manager (recommended)
with webhdfspy.WebHDFSClient("localhost", 50070, "username") as client:
    client.mkdir("/data")
    client.create("/data/hello.txt", "Hello, HDFS!", overwrite=True)
    print(client.open("/data/hello.txt"))

# HTTPS support
with webhdfspy.WebHDFSClient("host", 9871, "user", scheme="https") as client:
    print(client.listdir("/"))

# Custom timeout (default: 60s)
client = webhdfspy.WebHDFSClient("host", 50070, timeout=30.0)

Available operations

Method Description
listdir(path) List directory contents
mkdir(path, permission=None) Create directories
remove(path, recursive=False) Delete files/directories
rename(src, dst) Rename files/directories
open(path, offset=None, length=None, buffersize=None) Read a file
create(path, file_data, overwrite=None) Create a file
append(path, file_data, buffersize=None) Append to a file
copyfromlocal(local_path, hdfs_path, overwrite=None) Upload a local file
status(path) Get file/directory status
chmod(path, permission) Set permissions
set_owner(path, owner=None, group=None) Set owner/group
set_replication(path, replication_factor) Set replicaton factor
set_times(path, modificationtime=None, accesstime=None) Set modification/access time
get_checksum(path) Get file checksum
get_content_summary(path) Get directory content summary
environ_home() Get user home directory
get_delegation_token(renewer) Get a delegation token
renew_delegation_token(token) Renew a delegation token
cancel_delegation_token(token) Cancel a delegation token

Documentation

http://webhdfspy.readthedocs.org/en/latest/

Hadoop configuration

To enable WebHDFS in Hadoop, add this to your $HADOOP_DIR/conf/hdfs-site.xml:

<property>
    <name>dfs.webhdfs.enabled</name>
    <value>true</value>
</property>

To enable append on HDFS:

<property>
    <name>dfs.support.append</name>
    <value>true</value>
</property>

More about WebHDFS: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html

Release files for webhdfspy 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for webhdfspy 1.0.0
File Size Uploaded
webhdfspy-1.0.0.tar.gz 11.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for webhdfspy 1.0.0
File Interpreter ABI Platform
webhdfspy-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.8 kB

Release files / webhdfspy-1.0.0.tar.gz

Download URL webhdfspy-1.0.0.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
48d2d8cb096f3396f0499e91266a82123dbeccb3234f9e0c3e943a29b4b76186
BLAKE2b-256 checksum
How to use checksums
94724d9b77707df816a95b47303a4950a908f7773fb848cac4dd61229850c1b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.

Transparency log

Release files / webhdfspy-1.0.0-py3-none-any.whl

Download URL webhdfspy-1.0.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
680f2dbb9d4349c4cf597e47847d298c625c70eebd1d201dd55c50812b2e270c
BLAKE2b-256 checksum
How to use checksums
89b625cf051ede588087d2e89cd34602f42f17a31cbd71b33c7f5c71cd42eb90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.3.5

1 release file

0.3.4

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3

1 release file

0.2.1

1 release file

0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page