Last active
February 3, 2016 00:58
-
-
Save MichaelSEA/cb9ce21a1fdf3a18da64 to your computer and use it in GitHub Desktop.
quick snippet showing how to use Qumulo REST API to read file contents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tempfile | |
import qumulo.lib.auth | |
import qumulo.lib.request | |
import qumulo.rest.fs as fs | |
host = 'yourhost' | |
port = 8000 | |
user = 'user' | |
passwd = 'passwd' | |
filepath = '/path/file' | |
# login | |
connection = None | |
credentials = None | |
connection = qumulo.lib.request.Connection(host, port) | |
login_results, _ = qumulo.rest.auth.login(connection, None, user, passwd) | |
credentials = qumulo.lib.auth.Credentials.from_login_response(login_results) | |
# get file contents for a well-known file | |
file = tempfile.TemporaryFile() | |
fs.read_file(connection, credentials, file, path=filepath, id_=None) | |
# from here you can dump the content of file, etc. | |
print "done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment