Created
November 1, 2018 17:21
-
-
Save jbd/3504a32fdc3be782d774198e55711ea4 to your computer and use it in GitHub Desktop.
This file contains 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
from __future__ import print_function | |
import time | |
import os | |
import sys | |
import isi_sdk_8_1_0 | |
from isi_sdk_8_1_0.rest import ApiException | |
from pprint import pprint | |
import urllib3 | |
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
# Configure HTTP basic authorization: basicAuth | |
configuration = isi_sdk_8_1_0.Configuration() | |
configuration.username = os.getenv('ISI_USERNAME') | |
configuration.password = os.getenv('ISI_PASSWORD') | |
configuration.host = os.getenv('ISI_HOST') | |
configuration.verify_ssl = False | |
largv = len(sys.argv) | |
if largv < 2: | |
print("usage: %s directory [limit]" % sys.argv[0], file=sys.stderr) | |
sys.exit(1) | |
directory_path = sys.argv[1] | |
if largv == 3: | |
limit = int(sys.argv[2]) | |
else: | |
limit = None | |
# create an instance of the API class | |
api_instance = isi_sdk_8_1_0.NamespaceApi(isi_sdk_8_1_0.ApiClient(configuration)) | |
try: | |
if limit: | |
api_response = api_instance.get_directory_contents(directory_path, limit=limit) | |
else: | |
api_response = api_instance.get_directory_contents(directory_path) | |
if api_response.children: | |
pprint(len(api_response.children)) | |
else: | |
pprint(api_response) | |
except ApiException as e: | |
print("Exception when calling NamespaceApi->get_directory_contents: %s\n" % e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment