# 又拍云存储-s3 支持
## 接口说明
### 获取服务列表
list_buckets
参数
| 参数 | 必选 | 类型 | 说明 |
| ---- | ---- | ---- | ---- |
| None | None | None | None |
### 获取目录列表
list_folders
参数
| 参数 | 必选 | 类型 | 说明 |
| ------ | ---- | ---- | -------------- |
| bucket | 是 | str | 又拍云服务名称 |
### 获取目录文件列表
list_files
参数
| 参数 | 必选 | 类型 | 说明 |
| ------ | ---- | ---- | -------------- |
| bucket | 是 | str | 又拍云服务名称 |
| folder | 是 | str | 又拍云服务目录 |
### 删除文件
delete_file
参数
| 参数 | 必选 | 类型 | 说明 |
| ------ | ---- | ---- | -------------- |
| bucket | 是 | str | 又拍云服务名称 |
| file | 是 | str | 又拍云文件名称 |
### 删除目录
delete_folder
参数
| 参数 | 必选 | 类型 | 说明 |
| ------ | ---- | ---- | -------------- |
| bucket | 是 | str | 又拍云服务名称 |
| folder | 是 | str | 又拍云服务目录 |
### 创建目录
create_folder
参数
| 参数 | 必选 | 类型 | 说明 |
| ------ | ---- | ---- | -------------- |
| bucket | 是 | str | 又拍云服务名称 |
| folder | 是 | str | 又拍云服务目录 |
### 上传文件
upload_file
参数
| 参数 | 必选 | 类型 | 说明 |
| ----------- | ---- | ---- | ------------------------------------------------------------ |
| bucket | 是 | str | 又拍云服务名称 |
| file_path | 是 | str | 本地文件路径 |
| object_name | 否 | str | 如果 object 为 None,则又拍云的存储文件名称为 file_path 文件名,并且存放位置是根目录 |
### 获取文件信息
get_file_info
参数
| 参数 | 必选 | 类型 | 说明 |
| ----------- | ---- | ---- | ------------------ |
| bucket | 是 | str | 又拍云服务名称 |
| object_name | 是 | str | 又拍云存储文件名称 |
### 获取随机文件
get_random_file
参数
| 参数 | 必选 | 类型 | 说明 |
| ------ | ---- | ---- | -------------- |
| bucket | 是 | str | 又拍云服务名称 |
| folder | 是 | str | 又拍云服务目录 |
### 下载文件
download_file
参数
| 参数 | 必选 | 类型 | 说明 |
| ----------- | ---- | ---- | ------------------------ |
| bucket | 是 | str | 又拍云服务名称 |
| object_name | 是 | str | 又拍云存储文件名称 |
| file_path | 否 | str | 本地存储的文件路径及名称 |
### 生成预签名 URL
generate_presigned_url
| 参数 | 必选 | 类型 | 说明 |
| ----------- | ---- | ---- | ------------------------------------------------------- |
| bucket | 是 | str | 又拍云服务名称 |
| object_name | 是 | str | 又拍云存储文件名称 |
| expiration | 否 | int | 过期时间,单位秒,最大不能超过 604800,默认不填 3600 秒 |
## 代码示例
```python
from upyuns3client.upyuns3client import UpYunS3Client
ak = "xxxxx"
sk = "xxxxx"
client = UpYunS3Client(ak, sk)
client.generate_presigned_url(
bucket="test-bucket", object_name="test.png", expiration=3600
)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/evansuner/upyuns3client",
"name": "upyuns3client",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "upyun,python,sdk,s3",
"author": "Evan",
"author_email": "zhidong.s@outlook.com",
"download_url": "https://files.pythonhosted.org/packages/bc/24/eabaeb9ea32813f370a31deb6e30e7a680fd580c0e45efcffafce97503af/upyuns3client-0.1.4.tar.gz",
"platform": null,
"description": "# \u53c8\u62cd\u4e91\u5b58\u50a8-s3 \u652f\u6301\r\n\r\n## \u63a5\u53e3\u8bf4\u660e\r\n\r\n### \u83b7\u53d6\u670d\u52a1\u5217\u8868\r\n\r\nlist_buckets\r\n\r\n\u53c2\u6570\r\n| \u53c2\u6570 | \u5fc5\u9009 | \u7c7b\u578b | \u8bf4\u660e |\r\n| ---- | ---- | ---- | ---- |\r\n| None | None | None | None |\r\n\r\n### \u83b7\u53d6\u76ee\u5f55\u5217\u8868\r\n\r\nlist_folders\r\n\r\n\u53c2\u6570\r\n| \u53c2\u6570 | \u5fc5\u9009 | \u7c7b\u578b | \u8bf4\u660e |\r\n| ------ | ---- | ---- | -------------- |\r\n| bucket | \u662f | str | \u53c8\u62cd\u4e91\u670d\u52a1\u540d\u79f0 |\r\n\r\n### \u83b7\u53d6\u76ee\u5f55\u6587\u4ef6\u5217\u8868\r\n\r\nlist_files\r\n\r\n\u53c2\u6570\r\n| \u53c2\u6570 | \u5fc5\u9009 | \u7c7b\u578b | \u8bf4\u660e |\r\n| ------ | ---- | ---- | -------------- |\r\n| bucket | \u662f | str | \u53c8\u62cd\u4e91\u670d\u52a1\u540d\u79f0 |\r\n| folder | \u662f | str | \u53c8\u62cd\u4e91\u670d\u52a1\u76ee\u5f55 |\r\n\r\n### \u5220\u9664\u6587\u4ef6\r\n\r\ndelete_file\r\n\r\n\u53c2\u6570\r\n| \u53c2\u6570 | \u5fc5\u9009 | \u7c7b\u578b | \u8bf4\u660e |\r\n| ------ | ---- | ---- | -------------- |\r\n| bucket | \u662f | str | \u53c8\u62cd\u4e91\u670d\u52a1\u540d\u79f0 |\r\n| file | \u662f | str | \u53c8\u62cd\u4e91\u6587\u4ef6\u540d\u79f0 |\r\n\r\n### \u5220\u9664\u76ee\u5f55\r\n\r\ndelete_folder\r\n\r\n\u53c2\u6570\r\n| \u53c2\u6570 | \u5fc5\u9009 | \u7c7b\u578b | \u8bf4\u660e |\r\n| ------ | ---- | ---- | -------------- |\r\n| bucket | \u662f | str | \u53c8\u62cd\u4e91\u670d\u52a1\u540d\u79f0 |\r\n| folder | \u662f | str | \u53c8\u62cd\u4e91\u670d\u52a1\u76ee\u5f55 |\r\n\r\n### \u521b\u5efa\u76ee\u5f55\r\n\r\ncreate_folder\r\n\r\n\u53c2\u6570\r\n| \u53c2\u6570 | \u5fc5\u9009 | \u7c7b\u578b | \u8bf4\u660e |\r\n| ------ | ---- | ---- | -------------- |\r\n| bucket | \u662f | str | \u53c8\u62cd\u4e91\u670d\u52a1\u540d\u79f0 |\r\n| folder | \u662f | str | \u53c8\u62cd\u4e91\u670d\u52a1\u76ee\u5f55 |\r\n\r\n### \u4e0a\u4f20\u6587\u4ef6\r\n\r\nupload_file\r\n\r\n\u53c2\u6570\r\n| \u53c2\u6570 | \u5fc5\u9009 | \u7c7b\u578b | \u8bf4\u660e |\r\n| ----------- | ---- | ---- | ------------------------------------------------------------ |\r\n| bucket | \u662f | str | \u53c8\u62cd\u4e91\u670d\u52a1\u540d\u79f0 |\r\n| file_path | \u662f | str | \u672c\u5730\u6587\u4ef6\u8def\u5f84 |\r\n| object_name | \u5426 | str | \u5982\u679c object \u4e3a None\uff0c\u5219\u53c8\u62cd\u4e91\u7684\u5b58\u50a8\u6587\u4ef6\u540d\u79f0\u4e3a file_path \u6587\u4ef6\u540d\uff0c\u5e76\u4e14\u5b58\u653e\u4f4d\u7f6e\u662f\u6839\u76ee\u5f55 |\r\n\r\n### \u83b7\u53d6\u6587\u4ef6\u4fe1\u606f\r\n\r\nget_file_info\r\n\r\n\u53c2\u6570\r\n| \u53c2\u6570 | \u5fc5\u9009 | \u7c7b\u578b | \u8bf4\u660e |\r\n| ----------- | ---- | ---- | ------------------ |\r\n| bucket | \u662f | str | \u53c8\u62cd\u4e91\u670d\u52a1\u540d\u79f0 |\r\n| object_name | \u662f | str | \u53c8\u62cd\u4e91\u5b58\u50a8\u6587\u4ef6\u540d\u79f0 |\r\n\r\n### \u83b7\u53d6\u968f\u673a\u6587\u4ef6\r\n\r\nget_random_file\r\n\r\n\u53c2\u6570\r\n| \u53c2\u6570 | \u5fc5\u9009 | \u7c7b\u578b | \u8bf4\u660e |\r\n| ------ | ---- | ---- | -------------- |\r\n| bucket | \u662f | str | \u53c8\u62cd\u4e91\u670d\u52a1\u540d\u79f0 |\r\n| folder | \u662f | str | \u53c8\u62cd\u4e91\u670d\u52a1\u76ee\u5f55 |\r\n\r\n### \u4e0b\u8f7d\u6587\u4ef6\r\n\r\ndownload_file\r\n\r\n\u53c2\u6570\r\n| \u53c2\u6570 | \u5fc5\u9009 | \u7c7b\u578b | \u8bf4\u660e |\r\n| ----------- | ---- | ---- | ------------------------ |\r\n| bucket | \u662f | str | \u53c8\u62cd\u4e91\u670d\u52a1\u540d\u79f0 |\r\n| object_name | \u662f | str | \u53c8\u62cd\u4e91\u5b58\u50a8\u6587\u4ef6\u540d\u79f0 |\r\n| file_path | \u5426 | str | \u672c\u5730\u5b58\u50a8\u7684\u6587\u4ef6\u8def\u5f84\u53ca\u540d\u79f0 |\r\n\r\n### \u751f\u6210\u9884\u7b7e\u540d URL\r\n\r\ngenerate_presigned_url\r\n\r\n| \u53c2\u6570 | \u5fc5\u9009 | \u7c7b\u578b | \u8bf4\u660e |\r\n| ----------- | ---- | ---- | ------------------------------------------------------- |\r\n| bucket | \u662f | str | \u53c8\u62cd\u4e91\u670d\u52a1\u540d\u79f0 |\r\n| object_name | \u662f | str | \u53c8\u62cd\u4e91\u5b58\u50a8\u6587\u4ef6\u540d\u79f0 |\r\n| expiration | \u5426 | int | \u8fc7\u671f\u65f6\u95f4\uff0c\u5355\u4f4d\u79d2\uff0c\u6700\u5927\u4e0d\u80fd\u8d85\u8fc7 604800\uff0c\u9ed8\u8ba4\u4e0d\u586b 3600 \u79d2 |\r\n\r\n## \u4ee3\u7801\u793a\u4f8b\r\n\r\n```python\r\nfrom upyuns3client.upyuns3client import UpYunS3Client\r\nak = \"xxxxx\"\r\nsk = \"xxxxx\"\r\nclient = UpYunS3Client(ak, sk)\r\nclient.generate_presigned_url(\r\n bucket=\"test-bucket\", object_name=\"test.png\", expiration=3600\r\n)\r\n```\r\n",
"bugtrack_url": null,
"license": "License :: OSI Approved :: MIT License",
"summary": "UpYun Storage SDK for Python S3 Support",
"version": "0.1.4",
"project_urls": {
"Homepage": "https://github.com/evansuner/upyuns3client"
},
"split_keywords": [
"upyun",
"python",
"sdk",
"s3"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "acb6c100f1773b73fd8950fc5a07f8a9311f7b6e2455036212472a1ea72efc41",
"md5": "c907796900082c615f0c6a41f6848e28",
"sha256": "2c68d2f0a37e7f1a189400082e377ff6742977d647788be79c35a94572cedb4d"
},
"downloads": -1,
"filename": "upyuns3client-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c907796900082c615f0c6a41f6848e28",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4222,
"upload_time": "2023-08-25T05:39:37",
"upload_time_iso_8601": "2023-08-25T05:39:37.645509Z",
"url": "https://files.pythonhosted.org/packages/ac/b6/c100f1773b73fd8950fc5a07f8a9311f7b6e2455036212472a1ea72efc41/upyuns3client-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bc24eabaeb9ea32813f370a31deb6e30e7a680fd580c0e45efcffafce97503af",
"md5": "85ab2b95dc4b457e474026bd073ee9fe",
"sha256": "a433f49ba6de5808750e1b7b25b30906d45e11d8fca5ed6dcf221866b2b50f94"
},
"downloads": -1,
"filename": "upyuns3client-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "85ab2b95dc4b457e474026bd073ee9fe",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4696,
"upload_time": "2023-08-25T05:39:39",
"upload_time_iso_8601": "2023-08-25T05:39:39.260886Z",
"url": "https://files.pythonhosted.org/packages/bc/24/eabaeb9ea32813f370a31deb6e30e7a680fd580c0e45efcffafce97503af/upyuns3client-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-25 05:39:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "evansuner",
"github_project": "upyuns3client",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "upyuns3client"
}