Skip to content

Instantly share code, notes, and snippets.

@drelu
Created December 28, 2011 20:07
Show Gist options
  • Save drelu/1529478 to your computer and use it in GitHub Desktop.
Save drelu/1529478 to your computer and use it in GitHub Desktop.
WebHDFS Python Example
from webhdfs.webhdfs import WebHDFS
import os, tempfile
import time
webhdfs = WebHDFS("localhost", 50070, "luckow")
webhdfs.mkdir("/hello-world/")
# create a temporary file
f = tempfile.NamedTemporaryFile()
f.write(b'Hello world!\n')
f.flush()
print "Upload file: " + f.name
webhdfs.copyFromLocal(f.name,
"/hello-world/test.txt")
webhdfs.copyToLocal("/hello-world/test.txt",
"/tmp/test1.txt")
for i in webhdfs.listdir("/"):
print str(i)
f.close()
@vikks77
Copy link

vikks77 commented Feb 2, 2017

How do we use this with kerberos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment