Skip to content

Commit 7276cf7

Browse files
committed
added README
fixed Setup script added example
1 parent 27c2770 commit 7276cf7

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

README

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
WebHDFS is REST-API to HDFS. To facilitate access to WebHDFS from Python, webhdfs-py was developed. The library can easily be installed via easy_install or pip:
2+
3+
easy_install webhdfs
4+
5+
Webhdfs-py has no further dependencies and solely relies on the Python standard library. Similar to the Python os package, webhdfs-py provides basic capabilities like the creation/listing and deletion of directories on files.
6+

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
'Topic :: Utilities',
1717
],
1818
platforms = ('Unix', 'Linux', 'Mac OS'),
19-
packages=['webhdfs', 'examples'],
19+
packages=['webhdfs'],
2020
data_files=['webhdfs/VERSION'],
21-
install_requires=['httplib'],
21+
install_requires=[],
2222
entry_points = {
2323
'console_scripts': []
2424
}

webhdfs/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.0
1+
0.1.03

webhdfs/example.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from webhdfs.webhdfs import WebHDFS
2+
import os, tempfile
3+
import time
4+
5+
webhdfs = WebHDFS("localhost", 50070, "luckow")
6+
7+
webhdfs.mkdir("/hello-world/")
8+
9+
# create a temporary file
10+
f = tempfile.NamedTemporaryFile()
11+
f.write(b'Hello world!\n')
12+
f.flush()
13+
14+
print "Upload file: " + f.name
15+
16+
webhdfs.copyFromLocal(f.name,
17+
"/hello-world/test.txt")
18+
19+
webhdfs.copyToLocal("/hello-world/test.txt",
20+
"/tmp/test1.txt")
21+
22+
for i in webhdfs.listdir("/"):
23+
print str(i)
24+
25+
f.close()

0 commit comments

Comments
 (0)