Created
December 5, 2017 19:29
-
-
Save chianingwang/782fb2ca4e3b51240c56bbe3e09519ee to your computer and use it in GitHub Desktop.
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
# Code Example - PySwiftClientKeyStoneAuth.py | |
import swiftclient.client as swiftclient | |
# reference: # https://docs.openstack.org/python-swiftclient/latest/client-api.html | |
# v3 | |
#_authurl = 'http://172.28.128.43:35357/v3/' | |
#_auth_version = '3' | |
#_user = 'admin' | |
#_key = 'ADMIN' | |
#_os_options = { | |
# 'user_domain_name': 'Default', | |
# 'project_domain_name': 'Default', | |
# 'project_name': 'admin' | |
#} | |
#conn = swiftclient.Connection( | |
# authurl=_authurl, | |
# user=_user, | |
# key=_key, | |
# os_options=_os_options, | |
# auth_version=_auth_version | |
#) | |
# v2 | |
#_authurl = 'http://172.28.128.43:5000/v2.0/' | |
#_auth_version = '2' | |
#_user = 'admin' | |
#_key = 'ADMIN' | |
#_tenant_name = 'admin' | |
#conn = swiftclient.Connection( | |
# authurl=_authurl, | |
# user=_user, | |
# key=_key, | |
# tenant_name=_tenant_name, | |
# auth_version=_auth_version | |
#) | |
# legacy swift temp auth | |
# auth_url = 'http://172.28.128.42/auth/v1.0' | |
# conn = swiftclient.Connection( | |
# user = 'ss', | |
# key = 'ss', | |
# authurl=auth_url, | |
# auth_version='1', | |
# insecure=True) | |
# Container name for testing | |
container_name = 'testcontainer' | |
# File name for testing | |
# file_name = 'KeystoneAuth.py' | |
file_name = 'prep.sh' | |
# List your containers | |
result = conn.get_container(container_name) | |
print(result) | |
# List your object | |
# result = conn.get_object(container_name, file_name) | |
# print(result) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment