我想用 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')
Run Code Online (Sandbox Code Playgroud)
代码正在运行,但是,如何检查文件是否存储在 swift 中?Swift 文件夹中不存在该文件。
谢谢。
运行curl时出现以下错误:
curl:(7)无法连接到127.0.0.1端口8080:连接被拒绝。
似乎很容易调试,但是,我没有找到解决方法。文件中提到了地址127.0.0.1 etc/hosts。
我在Ubuntu系统上使用curl版本7.47。
有人对此有想法吗?
谢谢。