Skip to main content

A wrapper library to access Hadoop HTTP REST API

Project description

https://badge.fury.io/py/webhdfspy.svg

A Python 2/3 wrapper library to access Hadoop WebHDFS REST API

Installation

To install webhdfspy from PyPI:

$ pip install webhdfspy

Python versions

webhdfspy supports Python 2.7 and 3.4

Usage

>>> import webhdfspy
>>> webHDFS = webhdfspy.WebHDFSClient("localhost", 50070, "username")
>>> print(webHDFS.listdir('/'))
[]
>>> webHDFS.mkdir('/foo')
True
>>> print(webHDFS.listdir('/'))
[{u'group': u'supergroup', u'permission': u'755', u'blockSize': 0, u'accessTime': 0, u'pathSuffix': u'foo', u'modificationTime': 1429805040695, u'replication': 0, u'length': 0, u'childrenNum': 0, u'owner': u'username', u'storagePolicy': 0, u'type': u'DIRECTORY', u'fileId': 16387}]
>>> print webHDFS.create('/foo/foo.txt', "just put some text here", True)
True
>>> print webHDFS.open('/pywebhdfs_test/foo.txt')
just put some text here
>>> webHDFS.remove('/foo')
True
>>> print(webHDFS.listdir('/'))
[]

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 you need to configure your hdfs-site.xml as follows:

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

More about WebHDFS: https://hadoop.apache.org/docs/r1.0.4/webhdfs.html

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

webhdfspy-0.3.5.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file webhdfspy-0.3.5.tar.gz.

File metadata

  • Download URL: webhdfspy-0.3.5.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for webhdfspy-0.3.5.tar.gz
Algorithm Hash digest
SHA256 e6f1dac45358b83aef26e76cbfb3a21397fc8d6998c94cdbf416f6d49547288e
MD5 3cd5f82f6f0dfbb750049dffb2f37764
BLAKE2b-256 702e3b3192577e31ea3a071dd18d0a5498d4ef57e778cfe7489466caba387f73

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page