如何使用python在Swift存储系统中上载文件?

如何使用python在Swift存储系统中上载文件?,python,python-2.7,openstack-swift,Python,Python 2.7,Openstack Swift,我想用Swift上传一个文件。我用python执行了以下代码: import swiftclient swift = swiftclient.client.Connection(auth_version='1',user='test:tester',key='testing',authurl='http://localhost:8080/auth/v1.0') # Create the swift container swift.put_container('cute-cats') # Upl

我想用Swift上传一个文件。我用python执行了以下代码:

 import swiftclient
swift = swiftclient.client.Connection(auth_version='1',user='test:tester',key='testing',authurl='http://localhost:8080/auth/v1.0')
# Create the swift container
swift.put_container('cute-cats')
# Upload the object
with open('cat.jpg', 'rb') as f:
    file_data = f.read()
swift.put_object('cute-cats', 'cat.jpg', file_data)

# List the containers
print swift.head_account()

# List the objects in the cute cats containers
print swift.head_container('cute-cats')
代码正在运行,但是,如何检查文件是否存储在swift中?文件夹Swift中不存在该文件


谢谢。

从终端可以运行简单的卷曲:

$curl

如果要使用python代码进行测试,可以使用lib请求

文件夹Swift中不存在该文件

你指的是哪个文件夹?Swift通常使用散列存储其对象(文件),因此要查找对象,需要使用类似Swift get nodes的命令