Skip to content

Commit 9350ea1

Browse files
author
davis.zheng
committed
1. 修改python-sdk概述链接
2. 修改python-sdk获取目录文件列表代码 3. 更换百度统计账号代码 4. 加粗右侧边栏二三级目录
1 parent 413c28c commit 9350ea1

File tree

4 files changed

+38
-34
lines changed

4 files changed

+38
-34
lines changed

_includes/baidu-analysis.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
var _hmt = _hmt || [];
33
(function() {
44
var hm = document.createElement("script");
5-
hm.src = "https://hm.baidu.com/hm.js?4e6f9af579b843e5d89790505be99d96";
5+
hm.src = "https://hm.baidu.com/hm.js?afbe7ef4655052236c8cb513eb884ed2";
66
var s = document.getElementsByTagName("script")[0];
77
s.parentNode.insertBefore(hm, s);
88
})();

_sass/common/components/_toc.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,15 @@ ul.toc--ellipsis {
8686
}
8787
.toc-h2 {
8888
&, a {
89-
font-size:.95rem;
89+
font-size:.96rem;
90+
font-weight: 900;
9091

9192
}
9293
}
9394
.toc-h3 {
9495
&, a {
9596
font-size:.85rem;
96-
97+
font-weight: 500;
9798
}
9899
}
99100
}

collections/_python-sdk/概述.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ sidebar:
1717

1818
| 示例文件 | 示例内容 |
1919
| :----------------------------------------------------------- | :--------------------------------------- |
20-
| [quickstart.py](https://github.com/NightRain233/ufile-sdk-python/blob/master/examples/quickstart.py) | 快速入门,包括上传、下载、遍历、删除文件 |
21-
| [example_bucketmanager.py](https://github.com/NightRain233/ufile-sdk-python/blob/master/examples/example_bucketmanager.py) | 存储空间管理 |
22-
| [example_putfile.py](https://github.com/NightRain233/ufile-sdk-python/blob/master/examples/example_putfile.py) | 普通上传文件 |
23-
| [example_postfile.py](https://github.com/NightRain233/ufile-sdk-python/blob/master/examples/example_postfile.py) | 表单上传文件 |
24-
| [example_uploadhit.py](https://github.com/NightRain233/ufile-sdk-python/blob/master/examples/example_uploadhit.py) | 秒传文件 |
25-
| [example_multipartuploadufile.py](https://github.com/NightRain233/ufile-sdk-python/blob/master/examples/example_multipartuploadufile.py) | 分片上传和断点续传 |
26-
| [example_downloadfile.py](https://github.com/NightRain233/ufile-sdk-python/blob/master/examples/example_downloadfile.py) | 下载文件 |
27-
| [example_headfile.py](https://github.com/NightRain233/ufile-sdk-python/blob/master/examples/example_headfile.py) | 查询文件基本信息 |
28-
| [example_deletefile.py](https://github.com/NightRain233/ufile-sdk-python/blob/master/examples/example_deletefile.py) | 删除文件 |
29-
| [example_restorefile.py](https://github.com/NightRain233/ufile-sdk-python/blob/master/examples/example_restorefile.py) | 解冻归档文件 |
30-
| [example_class_switch_file.py](https://github.com/NightRain233/ufile-sdk-python/blob/master/examples/example_class_switch_file.py) | 文件类型转换 |
31-
| [example_compare_file_etag.py](https://github.com/NightRain233/ufile-sdk-python/blob/master/examples/example_compare_file_etag.py) | 比较本地文件和远程文件etag |
32-
| [example_getfilelist.py](https://github.com/NightRain233/ufile-sdk-python/blob/master/examples/example_getfilelist.py) | 前缀列表查询 |
33-
| [example_listobjects.py](https://github.com/NightRain233/ufile-sdk-python/blob/master/examples/example_listobjects.py) | 获取目录文件列表 |
34-
| [example_copy.py](https://github.com/NightRain233/ufile-sdk-python/blob/master/examples/example_copy.py) | 拷贝文件 |
35-
| [example_rename.py](https://github.com/NightRain233/ufile-sdk-python/blob/master/examples/example_rename.py) | 重命名文件 |
20+
| [quickstart.py](https://github.com/ucloud/ufile-sdk-python/blob/master/examples/quickstart.py) | 快速入门,包括上传、下载、遍历、删除文件 |
21+
| [example_bucketmanager.py](https://github.com/ucloud/ufile-sdk-python/blob/master/examples/example_bucketmanager.py) | 存储空间管理 |
22+
| [example_putfile.py](https://github.com/ucloud/ufile-sdk-python/blob/master/examples/example_putfile.py) | 普通上传文件 |
23+
| [example_postfile.py](https://github.com/ucloud/ufile-sdk-python/blob/master/examples/example_postfile.py) | 表单上传文件 |
24+
| [example_uploadhit.py](https://github.com/ucloud/ufile-sdk-python/blob/master/examples/example_uploadhit.py) | 秒传文件 |
25+
| [example_multipartuploadufile.py](https://github.com/ucloud/ufile-sdk-python/blob/master/examples/example_multipartuploadufile.py) | 分片上传和断点续传 |
26+
| [example_downloadfile.py](https://github.com/ucloud/ufile-sdk-python/blob/master/examples/example_downloadfile.py) | 下载文件 |
27+
| [example_headfile.py](https://github.com/ucloud/ufile-sdk-python/blob/master/examples/example_headfile.py) | 查询文件基本信息 |
28+
| [example_deletefile.py](https://github.com/ucloud/ufile-sdk-python/blob/master/examples/example_deletefile.py) | 删除文件 |
29+
| [example_restorefile.py](https://github.com/ucloud/ufile-sdk-python/blob/master/examples/example_restorefile.py) | 解冻归档文件 |
30+
| [example_class_switch_file.py](https://github.com/ucloud/ufile-sdk-python/blob/master/examples/example_class_switch_file.py) | 文件类型转换 |
31+
| [example_compare_file_etag.py](https://github.com/ucloud/ufile-sdk-python/blob/master/examples/example_compare_file_etag.py) | 比较本地文件和远程文件etag |
32+
| [example_getfilelist.py](https://github.com/ucloud/ufile-sdk-python/blob/master/examples/example_getfilelist.py) | 前缀列表查询 |
33+
| [example_listobjects.py](https://github.com/ucloud/ufile-sdk-python/blob/master/examples/example_listobjects.py) | 获取目录文件列表 |
34+
| [example_copy.py](https://github.com/ucloud/ufile-sdk-python/blob/master/examples/example_copy.py) | 拷贝文件 |
35+
| [example_rename.py](https://github.com/ucloud/ufile-sdk-python/blob/master/examples/example_rename.py) | 重命名文件 |

collections/_python-sdk/获取目录文件列表.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,8 @@ maxkeys=100 #指定返回目录文件列表的最大数量,默认值为100
7474
marker='' #返回以字母排序后,大于marker的目录文件列表
7575
delimiter='/' #delimiter是目录分隔符,当前只支持"/"和"",当Delimiter设置为"/"且prefiex以"/"结尾时,返回prefix目录下的子文件,当delimiter设置为""时,返回以prefix作为前缀的文件
7676

77-
ret, resp = listobjects_hander.listobjects(bucket, prefix=prefix, maxkeys=maxkeys, marker=marker, delimiter=delimiter)
78-
assert resp.status_code == 200
79-
80-
for object in ret['Contents']:#子文件列表
81-
print(object)
82-
83-
for object in ret['CommonPrefixes']:#子目录列表
84-
print(object)
85-
86-
# 根据返回值'NextMarker'循环遍历获得所有结果(若一次查询无法获得所有结果)
87-
while True:
77+
# 普通使用(一次查询即可得到所有结果)
78+
def once_list():
8879
ret, resp = listobjects_hander.listobjects(bucket, prefix=prefix, maxkeys=maxkeys, marker=marker, delimiter=delimiter)
8980
assert resp.status_code == 200
9081

@@ -93,9 +84,21 @@ while True:
9384

9485
for object in ret['CommonPrefixes']:#子目录列表
9586
print(object)
96-
97-
marker = ret['NextMarker']
98-
if len(marker) <= 0 or len(ret['Contents'])+len(ret['CommonPrefixes']) < maxkeys:
99-
break
87+
88+
# 因为一次查询返回数量存在最大限制,所以若一次查询无法获得所有结果,则根据返回值'NextMarker'循环遍历获得所有结果
89+
def loop_list():
90+
while True:
91+
ret, resp = listobjects_hander.listobjects(bucket, prefix=prefix, maxkeys=maxkeys, marker=marker, delimiter=delimiter)
92+
assert resp.status_code == 200
93+
94+
for object in ret['Contents']:#子文件列表
95+
print(object)
96+
97+
for object in ret['CommonPrefixes']:#子目录列表
98+
print(object)
99+
100+
marker = ret['NextMarker']
101+
if len(marker) <= 0 or maxkeys < len(ret['Contents']):
102+
break
100103
{% endhighlight %}
101104
</div>

0 commit comments

Comments
 (0)