p115client 0.0.5.5.4.1__py3-none-any.whl → 0.0.5.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- p115client/_upload.py +1 -1
- p115client/client.py +10738 -8532
- p115client/tool/download.py +1 -1
- p115client/tool/iterdir.py +2 -119
- p115client/tool/life.py +2 -1
- {p115client-0.0.5.5.4.1.dist-info → p115client-0.0.5.6.dist-info}/METADATA +2 -2
- {p115client-0.0.5.5.4.1.dist-info → p115client-0.0.5.6.dist-info}/RECORD +9 -9
- {p115client-0.0.5.5.4.1.dist-info → p115client-0.0.5.6.dist-info}/LICENSE +0 -0
- {p115client-0.0.5.5.4.1.dist-info → p115client-0.0.5.6.dist-info}/WHEEL +0 -0
p115client/tool/download.py
CHANGED
@@ -1120,7 +1120,7 @@ def iter_download_nodes(
|
|
1120
1120
|
"""获取一个目录内所有的文件或者目录的信息(简略)
|
1121
1121
|
|
1122
1122
|
:param client: 115 客户端或 cookies
|
1123
|
-
:param pickcode:
|
1123
|
+
:param pickcode: 目录的 提取码 或者 id
|
1124
1124
|
:param files: 如果为 True,则只获取文件,否则只获取目录
|
1125
1125
|
:param max_workers: 最大并发数,如果为 None 或 <= 0,则默认为 20
|
1126
1126
|
:param async_: 是否异步
|
p115client/tool/iterdir.py
CHANGED
@@ -9,8 +9,8 @@ __all__ = [
|
|
9
9
|
"iter_nodes_skim", "iter_stared_dirs_raw", "iter_stared_dirs", "ensure_attr_path",
|
10
10
|
"ensure_attr_path_by_category_get", "iterdir_raw", "iterdir", "iterdir_limited",
|
11
11
|
"iter_files_raw", "iter_files", "traverse_files", "iter_dupfiles", "iter_image_files",
|
12
|
-
"
|
13
|
-
"
|
12
|
+
"share_extract_payload", "share_iterdir", "share_iter_files", "iter_selected_nodes",
|
13
|
+
"iter_selected_nodes_by_pickcode", "iter_selected_nodes_using_category_get",
|
14
14
|
"iter_selected_nodes_using_edit", "iter_selected_nodes_using_star_event",
|
15
15
|
"iter_selected_dirs_using_star", "iter_files_with_dirname", "iter_files_with_path",
|
16
16
|
"iter_files_with_path_by_export_dir", "iter_parents_3_level", "iter_dir_nodes",
|
@@ -3040,123 +3040,6 @@ def iter_image_files(
|
|
3040
3040
|
return run_gen_step_iter(gen_step, async_=async_)
|
3041
3041
|
|
3042
3042
|
|
3043
|
-
@overload
|
3044
|
-
def iter_dangling_files(
|
3045
|
-
client: str | P115Client,
|
3046
|
-
cid: int = 0,
|
3047
|
-
page_size: int = 0,
|
3048
|
-
suffix: str = "",
|
3049
|
-
type: Literal[1, 2, 3, 4, 5, 6, 7, 99] = 99,
|
3050
|
-
normalize_attr: Callable[[dict], dict] = normalize_attr,
|
3051
|
-
app: str = "web",
|
3052
|
-
*,
|
3053
|
-
async_: Literal[False] = False,
|
3054
|
-
**request_kwargs,
|
3055
|
-
) -> Iterator[dict]:
|
3056
|
-
...
|
3057
|
-
@overload
|
3058
|
-
def iter_dangling_files(
|
3059
|
-
client: str | P115Client,
|
3060
|
-
cid: int = 0,
|
3061
|
-
page_size: int = 0,
|
3062
|
-
suffix: str = "",
|
3063
|
-
type: Literal[1, 2, 3, 4, 5, 6, 7, 99] = 99,
|
3064
|
-
normalize_attr: Callable[[dict], dict] = normalize_attr,
|
3065
|
-
app: str = "web",
|
3066
|
-
*,
|
3067
|
-
async_: Literal[True],
|
3068
|
-
**request_kwargs,
|
3069
|
-
) -> AsyncIterator[dict]:
|
3070
|
-
...
|
3071
|
-
def iter_dangling_files(
|
3072
|
-
client: str | P115Client,
|
3073
|
-
cid: int = 0,
|
3074
|
-
page_size: int = 0,
|
3075
|
-
suffix: str = "",
|
3076
|
-
type: Literal[1, 2, 3, 4, 5, 6, 7, 99] = 99,
|
3077
|
-
normalize_attr: Callable[[dict], dict] = normalize_attr,
|
3078
|
-
app: str = "web",
|
3079
|
-
*,
|
3080
|
-
async_: Literal[False, True] = False,
|
3081
|
-
**request_kwargs,
|
3082
|
-
) -> Iterator[dict] | AsyncIterator[dict]:
|
3083
|
-
"""找出所有悬空的文件,即所在的目录 id 不为 0 且不存在
|
3084
|
-
|
3085
|
-
.. todo::
|
3086
|
-
实际上,广义的悬空,包括所有这样的文件或目录,它们的祖先节点中存在一个节点,这个节点的 id 目前不存在于网盘(可能被删除或移入回收站)
|
3087
|
-
|
3088
|
-
.. danger::
|
3089
|
-
你可以用 `P115Client.fs_move` 方法,把文件或目录随意移动到任何目录 id 下,即使这个 id 不存在
|
3090
|
-
|
3091
|
-
.. note::
|
3092
|
-
你可以用 `P115Client.tool_space` 方法,把所有悬空文件找出来,放到专门的目录中,但这个接口一天只能用一次
|
3093
|
-
|
3094
|
-
:param client: 115 客户端或 cookies
|
3095
|
-
:param cid: 目录 id
|
3096
|
-
:param page_size: 分页大小
|
3097
|
-
:param suffix: 后缀名(优先级高于 type)
|
3098
|
-
:param type: 文件类型
|
3099
|
-
|
3100
|
-
- 1: 文档
|
3101
|
-
- 2: 图片
|
3102
|
-
- 3: 音频
|
3103
|
-
- 4: 视频
|
3104
|
-
- 5: 压缩包
|
3105
|
-
- 6: 应用
|
3106
|
-
- 7: 书籍
|
3107
|
-
- 99: 仅文件
|
3108
|
-
|
3109
|
-
:param normalize_attr: 把数据进行转换处理,使之便于阅读
|
3110
|
-
:param app: 使用某个 app (设备)的接口
|
3111
|
-
:param async_: 是否异步
|
3112
|
-
:param request_kwargs: 其它请求参数
|
3113
|
-
|
3114
|
-
:return: 迭代器,返回此目录内的(仅文件)文件信息
|
3115
|
-
"""
|
3116
|
-
if not isinstance(client, P115Client):
|
3117
|
-
client = P115Client(client, check_for_relogin=True)
|
3118
|
-
if page_size <= 0:
|
3119
|
-
page_size = 10_000
|
3120
|
-
elif page_size < 16:
|
3121
|
-
page_size = 16
|
3122
|
-
if app in ("", "web", "desktop", "harmony"):
|
3123
|
-
fs_files: Callable = client.fs_files
|
3124
|
-
else:
|
3125
|
-
fs_files = partial(client.fs_files_app, app=app)
|
3126
|
-
def gen_step():
|
3127
|
-
na_cids: set[int] = set()
|
3128
|
-
ok_cids: set[int] = set()
|
3129
|
-
payload = {"cid": cid, "limit": page_size, "offset": 0, "suffix": suffix, "type": type}
|
3130
|
-
while True:
|
3131
|
-
resp = yield fs_files(payload, async_=async_, **request_kwargs)
|
3132
|
-
if cid and int(resp["path"][-1]["cid"]) != cid:
|
3133
|
-
break
|
3134
|
-
if resp["offset"] != payload["offset"]:
|
3135
|
-
break
|
3136
|
-
t = tuple(map(_overview_attr, resp["data"]))
|
3137
|
-
pids = {
|
3138
|
-
pid for a in t
|
3139
|
-
if (pid := a.parent_id) not in na_cids
|
3140
|
-
and pid not in ok_cids
|
3141
|
-
}
|
3142
|
-
if pids:
|
3143
|
-
if async_:
|
3144
|
-
na_cids.update(iter_nodes_skim(client, pids, **request_kwargs))
|
3145
|
-
else:
|
3146
|
-
yield async_foreach(
|
3147
|
-
na_cids.add,
|
3148
|
-
iter_nodes_skim(client, pids, async_=True, **request_kwargs),
|
3149
|
-
)
|
3150
|
-
ok_cids |= pids - na_cids
|
3151
|
-
for a, info in zip(t, resp["data"]):
|
3152
|
-
if a.parent_id in na_cids:
|
3153
|
-
yield Yield(normalize_attr(info), identity=True)
|
3154
|
-
payload["offset"] += len(resp["data"]) # type: ignore
|
3155
|
-
if payload["offset"] >= resp["count"]:
|
3156
|
-
break
|
3157
|
-
return run_gen_step_iter(gen_step, async_=async_)
|
3158
|
-
|
3159
|
-
|
3160
3043
|
def share_extract_payload(link: str, /) -> SharePayload:
|
3161
3044
|
"""从链接中提取 share_code 和 receive_code
|
3162
3045
|
|
p115client/tool/life.py
CHANGED
@@ -11,7 +11,7 @@ __doc__ = "这个模块提供了一些和 115 生活操作事件有关的函数"
|
|
11
11
|
from asyncio import sleep as async_sleep
|
12
12
|
from collections.abc import AsyncIterator, Container, Coroutine, Iterator
|
13
13
|
from functools import partial
|
14
|
-
from itertools import count
|
14
|
+
from itertools import count, cycle
|
15
15
|
from time import time, sleep
|
16
16
|
from typing import overload, Any, Final, Literal
|
17
17
|
|
@@ -243,6 +243,7 @@ def iter_life_behavior_once(
|
|
243
243
|
if app in ("", "web", "desktop", "harmony"):
|
244
244
|
life_behavior_detail = partial(client.life_behavior_detail, **request_kwargs)
|
245
245
|
else:
|
246
|
+
request_kwargs.setdefault("base_url", cycle(("http://proapi.115.com", "https://proapi.115.com")).__next__)
|
246
247
|
life_behavior_detail = partial(client.life_behavior_detail_app, app=app, **request_kwargs)
|
247
248
|
if first_batch_size <= 0:
|
248
249
|
first_batch_size = 64 if from_time or from_id else 1000
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: p115client
|
3
|
-
Version: 0.0.5.
|
3
|
+
Version: 0.0.5.6
|
4
4
|
Summary: Python 115 webdisk client.
|
5
5
|
Home-page: https://github.com/ChenyangGao/p115client
|
6
6
|
License: MIT
|
@@ -40,7 +40,7 @@ Requires-Dist: python-filewrap (>=0.2.6.1)
|
|
40
40
|
Requires-Dist: python-hashtools (>=0.0.3.3)
|
41
41
|
Requires-Dist: python-http_request (>=0.0.6)
|
42
42
|
Requires-Dist: python-httpfile (>=0.0.5)
|
43
|
-
Requires-Dist: python-iterutils (>=0.1.
|
43
|
+
Requires-Dist: python-iterutils (>=0.1.8)
|
44
44
|
Requires-Dist: python-property (>=0.0.3)
|
45
45
|
Requires-Dist: python-startfile (>=0.0.2)
|
46
46
|
Requires-Dist: python-undefined (>=0.0.3)
|
@@ -1,23 +1,23 @@
|
|
1
1
|
LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
|
2
2
|
p115client/__init__.py,sha256=1mx7njuAlqcuEWONTjSiiGnXyyNyqOcJyNX1FMHqQ-4,214
|
3
|
-
p115client/_upload.py,sha256=
|
4
|
-
p115client/client.py,sha256=
|
3
|
+
p115client/_upload.py,sha256=j2XHz6-hc9qyfiF92aZY-LPJ3UgbB6e4Jy6CNGQ5rwk,29904
|
4
|
+
p115client/client.py,sha256=ACDHsjrxhPCeEN44Dgtd6l3wUrIKDLUmQqQYs1_dHL4,695455
|
5
5
|
p115client/const.py,sha256=maIZfJAiUuEnXIKc8TMAyW_UboDUJPwYpPS8LjPFp_U,4321
|
6
6
|
p115client/exception.py,sha256=Ugjr__aSlYRDYwoOz7273ngV-gFX2z-ohsJmCba8nnQ,2657
|
7
7
|
p115client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
p115client/tool/__init__.py,sha256=2YrKoAcFYOuqu2nUBoPVhxMOseAvcLE_LcnbZV11UKw,324
|
9
|
-
p115client/tool/download.py,sha256=
|
9
|
+
p115client/tool/download.py,sha256=KY-8QHhCm_Mk-ygtuQXuPtoIIJHRWg5XNQQx0WDncGA,56232
|
10
10
|
p115client/tool/edit.py,sha256=NQiyVoOKKed6VbUj_AamGmTWXfcioOFqq5buFUWOh_8,16428
|
11
11
|
p115client/tool/export_dir.py,sha256=QFHK5HKllTV6ZgCnnf_BFd4CQq-gqcuLx49clcbvmDo,23871
|
12
12
|
p115client/tool/fs_files.py,sha256=aOU2Ea7_CLUfzq3_UJx2SBF8ubJYAkZ4J-e2H3OfqpA,15602
|
13
|
-
p115client/tool/iterdir.py,sha256=
|
14
|
-
p115client/tool/life.py,sha256=
|
13
|
+
p115client/tool/iterdir.py,sha256=hpzOCaYi0-8XA6yS3RVnMp9a1FT25qjpZwnPJYNOXYw,183974
|
14
|
+
p115client/tool/life.py,sha256=8STXfjL8DPp0YTLFsE7Dt_6c2wj_0AvScq6WrjX9i9M,17583
|
15
15
|
p115client/tool/pool.py,sha256=vFV3t4g8KuQ4Rlttd1bs7d0Lc8jFUufdmDQweMcLZZw,9779
|
16
16
|
p115client/tool/request.py,sha256=SWsezW9EYZGS3R-TbZxMG-8bN3YWJ0-GzgvKlvRBSCM,7042
|
17
17
|
p115client/tool/upload.py,sha256=qK1OQYxP-Faq2eMDhc5sBXJiSr8m8EZ_gb0O_iA2TrI,15915
|
18
18
|
p115client/tool/xys.py,sha256=6NZUkWNsWW6dHDBUpMitmE-1YlkobWIUQ86CBjKJ4mQ,3633
|
19
19
|
p115client/type.py,sha256=e4g9URQBE23XN2dGomldj8wC6NlDWBBSVC5Bmd8giBc,5993
|
20
|
-
p115client-0.0.5.
|
21
|
-
p115client-0.0.5.
|
22
|
-
p115client-0.0.5.
|
23
|
-
p115client-0.0.5.
|
20
|
+
p115client-0.0.5.6.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
|
21
|
+
p115client-0.0.5.6.dist-info/METADATA,sha256=KpX4b-rW6E61AkjJKXUAeWpS8tmsUp39siioxd6aYQU,7141
|
22
|
+
p115client-0.0.5.6.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
23
|
+
p115client-0.0.5.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|