小编Ame*_*lie的帖子

如何使用 python 在 Swift Storage 系统中上传文件?

我想用 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 文件夹中不存在该文件。

谢谢。

python openstack-swift python-2.7

5
推荐指数
1
解决办法
1691
查看次数

卷曲:连接被拒绝

运行curl时出现以下错误:

curl:(7)无法连接到127.0.0.1端口8080:连接被拒绝。

似乎很容易调试,但是,我没有找到解决方法。文件中提到了地址127.0.0.1 etc/hosts

我在Ubuntu系统上使用curl版本7.47。

有人对此有想法吗?

谢谢。

linux ubuntu curl

3
推荐指数
2
解决办法
5万
查看次数

标签 统计

curl ×1

linux ×1

openstack-swift ×1

python ×1

python-2.7 ×1

ubuntu ×1