p115client 0.0.5.6.7__tar.gz → 0.0.5.6.9__tar.gz
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-0.0.5.6.7 → p115client-0.0.5.6.9}/PKG-INFO +4 -4
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/p115client/client.py +20 -20
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/p115client/tool/export_dir.py +6 -3
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/p115client/tool/fs_files.py +6 -15
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/p115client/tool/iterdir.py +36 -8
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/pyproject.toml +4 -4
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/LICENSE +0 -0
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/p115client/__init__.py +0 -0
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/p115client/_upload.py +0 -0
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/p115client/const.py +0 -0
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/p115client/exception.py +0 -0
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/p115client/py.typed +0 -0
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/p115client/tool/__init__.py +0 -0
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/p115client/tool/download.py +0 -0
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/p115client/tool/edit.py +0 -0
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/p115client/tool/life.py +0 -0
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/p115client/tool/pool.py +0 -0
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/p115client/tool/request.py +0 -0
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/p115client/tool/upload.py +0 -0
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/p115client/tool/xys.py +0 -0
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/p115client/type.py +0 -0
- {p115client-0.0.5.6.7 → p115client-0.0.5.6.9}/readme.md +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: p115client
|
3
|
-
Version: 0.0.5.6.
|
3
|
+
Version: 0.0.5.6.9
|
4
4
|
Summary: Python 115 webdisk client.
|
5
5
|
Home-page: https://github.com/ChenyangGao/p115client
|
6
6
|
License: MIT
|
@@ -31,15 +31,15 @@ Requires-Dist: orjson
|
|
31
31
|
Requires-Dist: p115cipher (>=0.0.3)
|
32
32
|
Requires-Dist: posixpatht (>=0.0.3)
|
33
33
|
Requires-Dist: python-argtools (>=0.0.1)
|
34
|
-
Requires-Dist: python-asynctools (>=0.
|
34
|
+
Requires-Dist: python-asynctools (>=0.1)
|
35
35
|
Requires-Dist: python-concurrenttools (>=0.0.8.2)
|
36
36
|
Requires-Dist: python-cookietools (>=0.0.2.1)
|
37
37
|
Requires-Dist: python-dictattr (>=0.0.4)
|
38
38
|
Requires-Dist: python-encode_uri (>=0.0.1)
|
39
|
-
Requires-Dist: python-filewrap (>=0.2.
|
39
|
+
Requires-Dist: python-filewrap (>=0.2.7.1)
|
40
40
|
Requires-Dist: python-hashtools (>=0.0.3.3)
|
41
41
|
Requires-Dist: python-http_request (>=0.0.6)
|
42
|
-
Requires-Dist: python-httpfile (>=0.0.5)
|
42
|
+
Requires-Dist: python-httpfile (>=0.0.5.1)
|
43
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)
|
@@ -1280,7 +1280,7 @@ class ClientRequestMixin:
|
|
1280
1280
|
async_: Literal[False, True] = False,
|
1281
1281
|
**request_kwargs,
|
1282
1282
|
) -> dict | Coroutine[Any, Any, dict]:
|
1283
|
-
"""
|
1283
|
+
"""绑定扫码并获取开放平台应用的 access_token 和 refresh_token
|
1284
1284
|
|
1285
1285
|
POST https://qrcodeapi.115.com/open/deviceCodeToToken
|
1286
1286
|
|
@@ -1331,7 +1331,7 @@ class ClientRequestMixin:
|
|
1331
1331
|
async_: Literal[False, True] = False,
|
1332
1332
|
**request_kwargs,
|
1333
1333
|
) -> dict | Coroutine[Any, Any, dict]:
|
1334
|
-
"""
|
1334
|
+
"""用一个 refresh_token 去获取新的 access_token 和 refresh_token,然后原来的 refresh_token 作废
|
1335
1335
|
|
1336
1336
|
POST https://qrcodeapi.115.com/open/refreshToken
|
1337
1337
|
|
@@ -1569,7 +1569,7 @@ class ClientRequestMixin:
|
|
1569
1569
|
async_: Literal[False, True] = False,
|
1570
1570
|
**request_kwargs,
|
1571
1571
|
) -> dict | Coroutine[Any, Any, dict]:
|
1572
|
-
"""
|
1572
|
+
"""获取开放平台的登录二维码,扫码可用
|
1573
1573
|
|
1574
1574
|
POST https://qrcodeapi.115.com/open/authDeviceCode
|
1575
1575
|
|
@@ -2676,9 +2676,9 @@ class P115OpenClient(ClientRequestMixin):
|
|
2676
2676
|
if isinstance(headers, Mapping):
|
2677
2677
|
headers = ItemsView(headers)
|
2678
2678
|
headers = request_kwargs["headers"] = {
|
2679
|
-
"
|
2679
|
+
"user-agent": next((v for k, v in headers if k.lower() == "user-agent" and v), "")}
|
2680
2680
|
else:
|
2681
|
-
headers = request_kwargs["headers"] = {"
|
2681
|
+
headers = request_kwargs["headers"] = {"user-agent": ""}
|
2682
2682
|
def parse(_, content: bytes, /) -> dict:
|
2683
2683
|
json = json_loads(content)
|
2684
2684
|
json["headers"] = headers
|
@@ -3863,12 +3863,12 @@ class P115OpenClient(ClientRequestMixin):
|
|
3863
3863
|
if async_:
|
3864
3864
|
from httpfile import AsyncHttpxFileReader
|
3865
3865
|
async def request():
|
3866
|
-
file = await AsyncHttpxFileReader.new(url, headers={"
|
3866
|
+
file = await AsyncHttpxFileReader.new(url, headers={"user-agent": ""})
|
3867
3867
|
async with file:
|
3868
3868
|
return await do_upload(file)
|
3869
3869
|
return request
|
3870
3870
|
else:
|
3871
|
-
with HTTPFileReader(url, headers={"
|
3871
|
+
with HTTPFileReader(url, headers={"user-agent": ""}) as file:
|
3872
3872
|
return do_upload(file)
|
3873
3873
|
elif isinstance(file, (str, PathLike)):
|
3874
3874
|
path = fsdecode(file)
|
@@ -6441,9 +6441,9 @@ class P115Client(P115OpenClient):
|
|
6441
6441
|
if isinstance(headers, Mapping):
|
6442
6442
|
headers = ItemsView(headers)
|
6443
6443
|
headers = request_kwargs["headers"] = {
|
6444
|
-
"
|
6444
|
+
"user-agent": next((v for k, v in headers if k.lower() == "user-agent" and v), "")}
|
6445
6445
|
else:
|
6446
|
-
headers = request_kwargs["headers"] = {"
|
6446
|
+
headers = request_kwargs["headers"] = {"user-agent": ""}
|
6447
6447
|
def parse(_, content: bytes, /) -> dict:
|
6448
6448
|
json = json_loads(content)
|
6449
6449
|
if json["state"]:
|
@@ -6506,9 +6506,9 @@ class P115Client(P115OpenClient):
|
|
6506
6506
|
if isinstance(headers, Mapping):
|
6507
6507
|
headers = ItemsView(headers)
|
6508
6508
|
headers = request_kwargs["headers"] = {
|
6509
|
-
"
|
6509
|
+
"user-agent": next((v for k, v in headers if k.lower() == "user-agent" and v), "")}
|
6510
6510
|
else:
|
6511
|
-
headers = request_kwargs["headers"] = {"
|
6511
|
+
headers = request_kwargs["headers"] = {"user-agent": ""}
|
6512
6512
|
def parse(resp, content: bytes, /) -> dict:
|
6513
6513
|
json = json_loads(content)
|
6514
6514
|
if "Set-Cookie" in resp.headers:
|
@@ -6702,9 +6702,9 @@ class P115Client(P115OpenClient):
|
|
6702
6702
|
if isinstance(headers, Mapping):
|
6703
6703
|
headers = ItemsView(headers)
|
6704
6704
|
headers = request_kwargs["headers"] = {
|
6705
|
-
"
|
6705
|
+
"user-agent": next((v for k, v in headers if k.lower() == "user-agent" and v), "")}
|
6706
6706
|
else:
|
6707
|
-
headers = request_kwargs["headers"] = {"
|
6707
|
+
headers = request_kwargs["headers"] = {"user-agent": ""}
|
6708
6708
|
def parse(_, content: bytes, /) -> dict:
|
6709
6709
|
json = json_loads(content)
|
6710
6710
|
json["headers"] = headers
|
@@ -6758,9 +6758,9 @@ class P115Client(P115OpenClient):
|
|
6758
6758
|
if isinstance(headers, Mapping):
|
6759
6759
|
headers = ItemsView(headers)
|
6760
6760
|
headers = request_kwargs["headers"] = {
|
6761
|
-
"
|
6761
|
+
"user-agent": next((v for k, v in headers if k.lower() == "user-agent" and v), "")}
|
6762
6762
|
else:
|
6763
|
-
headers = request_kwargs["headers"] = {"
|
6763
|
+
headers = request_kwargs["headers"] = {"user-agent": ""}
|
6764
6764
|
def parse(resp, content: bytes, /) -> dict:
|
6765
6765
|
json = json_loads(content)
|
6766
6766
|
if "Set-Cookie" in resp.headers:
|
@@ -13878,7 +13878,7 @@ class P115Client(P115OpenClient):
|
|
13878
13878
|
GET http://115.com/api/video/m3u8/{pickcode}.m3u8?definition={definition}
|
13879
13879
|
|
13880
13880
|
.. attention::
|
13881
|
-
这个接口只支持 web 的 cookies,其它设备会返回空数据,而且获取得到的 m3u8 里的链接,也是 m3u8,会绑定前一次请求时的
|
13881
|
+
这个接口只支持 web 的 cookies,其它设备会返回空数据,而且获取得到的 m3u8 里的链接,也是 m3u8,会绑定前一次请求时的 user-agent
|
13882
13882
|
|
13883
13883
|
:param pickcode: 视频文件的 pickcode
|
13884
13884
|
:params definition: 画质,默认列出所有画质。但可进行筛选,常用的为:
|
@@ -16023,7 +16023,7 @@ class P115Client(P115OpenClient):
|
|
16023
16023
|
payload["app_ver"] = "99.99.99.99"
|
16024
16024
|
request_kwargs["headers"] = {
|
16025
16025
|
**(request_kwargs.get("headers") or {}),
|
16026
|
-
"
|
16026
|
+
"user-agent": "Mozilla/5.0 115disk/99.99.99.99 115Browser/99.99.99.99 115wangpan_android/99.99.99.99",
|
16027
16027
|
}
|
16028
16028
|
request_kwargs["ecdh_encrypt"] = False
|
16029
16029
|
def parse(_, content: bytes, /) -> dict:
|
@@ -18799,7 +18799,7 @@ class P115Client(P115OpenClient):
|
|
18799
18799
|
request_kwargs["headers"] = {
|
18800
18800
|
**(request_kwargs.get("headers") or {}),
|
18801
18801
|
"Content-Type": "application/x-www-form-urlencoded",
|
18802
|
-
"
|
18802
|
+
"user-agent": "Mozilla/5.0 115disk/99.99.99.99 115Browser/99.99.99.99 115wangpan_android/99.99.99.99",
|
18803
18803
|
}
|
18804
18804
|
request_kwargs.setdefault("parse", parse_upload_init_response)
|
18805
18805
|
return self.upload_init(async_=async_, **request_kwargs)
|
@@ -19276,12 +19276,12 @@ class P115Client(P115OpenClient):
|
|
19276
19276
|
if async_:
|
19277
19277
|
from httpfile import AsyncHttpxFileReader
|
19278
19278
|
async def request():
|
19279
|
-
file = await AsyncHttpxFileReader.new(url, headers={"
|
19279
|
+
file = await AsyncHttpxFileReader.new(url, headers={"user-agent": ""})
|
19280
19280
|
async with file:
|
19281
19281
|
return await do_upload(file)
|
19282
19282
|
return request
|
19283
19283
|
else:
|
19284
|
-
with HTTPFileReader(url, headers={"
|
19284
|
+
with HTTPFileReader(url, headers={"user-agent": ""}) as file:
|
19285
19285
|
return do_upload(file)
|
19286
19286
|
elif isinstance(file, (str, PathLike)):
|
19287
19287
|
path = fsdecode(file)
|
@@ -628,9 +628,12 @@ def export_dir_parse_iter(
|
|
628
628
|
yield YieldFrom(parse_iter(file_wrapper), identity=True) # type: ignore
|
629
629
|
finally:
|
630
630
|
if async_:
|
631
|
-
|
632
|
-
|
633
|
-
file
|
631
|
+
if callable(aclose := getattr(file, "aclose", None)):
|
632
|
+
yield aclose
|
633
|
+
elif callable(close := getattr(file, "close", None)):
|
634
|
+
yield ensure_async(close, threaded=True)
|
635
|
+
elif callable(close := getattr(file, "close", None)):
|
636
|
+
close()
|
634
637
|
finally:
|
635
638
|
if delete:
|
636
639
|
yield client.fs_delete(
|
@@ -114,14 +114,11 @@ def iter_fs_files(
|
|
114
114
|
"limit": first_page_size, "show_dir": 1, **payload,
|
115
115
|
}
|
116
116
|
cid = int(payload["cid"])
|
117
|
-
if isinstance(client,
|
118
|
-
|
119
|
-
fs_files = partial(client.fs_files, **request_kwargs)
|
117
|
+
if not isinstance(client, P115Client) or app == "open":
|
118
|
+
fs_files = partial(client.fs_files_open, **request_kwargs)
|
120
119
|
elif app in ("", "web", "desktop", "harmony"):
|
121
120
|
request_kwargs.setdefault("base_url", get_webapi_origin)
|
122
121
|
fs_files = partial(client.fs_files, **request_kwargs)
|
123
|
-
elif app == "open":
|
124
|
-
fs_files = partial(client.fs_files_open, **request_kwargs)
|
125
122
|
else:
|
126
123
|
request_kwargs.setdefault("base_url", get_proapi_origin)
|
127
124
|
fs_files = partial(client.fs_files_app, app=app, **request_kwargs)
|
@@ -211,15 +208,12 @@ def iter_fs_files_threaded(
|
|
211
208
|
"limit": page_size, "show_dir": 1, **payload,
|
212
209
|
}
|
213
210
|
cid = int(payload["cid"])
|
214
|
-
if isinstance(client,
|
215
|
-
|
216
|
-
fs_files = partial(client.fs_files, **request_kwargs)
|
211
|
+
if not isinstance(client, P115Client) or app == "open":
|
212
|
+
fs_files = partial(client.fs_files_open, **request_kwargs)
|
217
213
|
elif app in ("", "web", "desktop", "harmony"):
|
218
214
|
page_size = min(page_size, 1150)
|
219
215
|
request_kwargs.setdefault("base_url", get_webapi_origin)
|
220
216
|
fs_files = partial(client.fs_files, **request_kwargs)
|
221
|
-
elif app == "open":
|
222
|
-
fs_files = partial(client.fs_files_open, **request_kwargs)
|
223
217
|
else:
|
224
218
|
request_kwargs.setdefault("base_url", get_proapi_origin)
|
225
219
|
fs_files = partial(client.fs_files_app, app=app, **request_kwargs)
|
@@ -328,15 +322,12 @@ async def iter_fs_files_asynchronized(
|
|
328
322
|
"limit": page_size, "show_dir": 1, **payload,
|
329
323
|
}
|
330
324
|
cid = int(payload["cid"])
|
331
|
-
if isinstance(client,
|
332
|
-
|
333
|
-
fs_files = partial(client.fs_files, **request_kwargs)
|
325
|
+
if not isinstance(client, P115Client) or app == "open":
|
326
|
+
fs_files = partial(client.fs_files_open, **request_kwargs)
|
334
327
|
elif app in ("", "web", "desktop", "harmony"):
|
335
328
|
page_size = min(page_size, 1150)
|
336
329
|
request_kwargs.setdefault("base_url", get_webapi_origin)
|
337
330
|
fs_files = partial(client.fs_files, **request_kwargs)
|
338
|
-
elif app == "open":
|
339
|
-
fs_files = partial(client.fs_files_open, **request_kwargs)
|
340
331
|
else:
|
341
332
|
request_kwargs.setdefault("base_url", get_proapi_origin)
|
342
333
|
fs_files = partial(client.fs_files_app, app=app, **request_kwargs)
|
@@ -3333,11 +3333,25 @@ def iter_selected_nodes(
|
|
3333
3333
|
return normalize_attr(info)
|
3334
3334
|
if async_:
|
3335
3335
|
request_kwargs["async_"] = True
|
3336
|
-
return async_filter(None, async_map(
|
3337
|
-
|
3336
|
+
return async_filter(None, async_map(
|
3337
|
+
project, # type: ignore
|
3338
|
+
taskgroup_map(
|
3339
|
+
client.fs_file, # type: ignore
|
3340
|
+
ids,
|
3341
|
+
max_workers=max_workers,
|
3342
|
+
kwargs=request_kwargs,
|
3343
|
+
),
|
3344
|
+
))
|
3338
3345
|
else:
|
3339
|
-
return filter(None, map(
|
3340
|
-
|
3346
|
+
return filter(None, map(
|
3347
|
+
project,
|
3348
|
+
threadpool_map(
|
3349
|
+
client.fs_file,
|
3350
|
+
ids,
|
3351
|
+
max_workers=max_workers,
|
3352
|
+
kwargs=request_kwargs,
|
3353
|
+
),
|
3354
|
+
))
|
3341
3355
|
|
3342
3356
|
|
3343
3357
|
@overload
|
@@ -3521,11 +3535,25 @@ def iter_selected_nodes_using_edit(
|
|
3521
3535
|
args_it = ({"file_id": fid, "show_play_long": 1} for fid in ids)
|
3522
3536
|
if async_:
|
3523
3537
|
request_kwargs["async_"] = True
|
3524
|
-
return async_filter(None, async_map(
|
3525
|
-
|
3538
|
+
return async_filter(None, async_map(
|
3539
|
+
project, # type: ignore
|
3540
|
+
taskgroup_map(
|
3541
|
+
client.fs_edit_app, # type: ignore
|
3542
|
+
args_it,
|
3543
|
+
max_workers=max_workers,
|
3544
|
+
kwargs=request_kwargs,
|
3545
|
+
),
|
3546
|
+
))
|
3526
3547
|
else:
|
3527
|
-
return filter(None, map(
|
3528
|
-
|
3548
|
+
return filter(None, map(
|
3549
|
+
project,
|
3550
|
+
threadpool_map(
|
3551
|
+
client.fs_edit_app,
|
3552
|
+
args_it,
|
3553
|
+
max_workers=max_workers,
|
3554
|
+
kwargs=request_kwargs,
|
3555
|
+
),
|
3556
|
+
))
|
3529
3557
|
|
3530
3558
|
|
3531
3559
|
@overload
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "p115client"
|
3
|
-
version = "0.0.5.6.
|
3
|
+
version = "0.0.5.6.9"
|
4
4
|
description = "Python 115 webdisk client."
|
5
5
|
authors = ["ChenyangGao <wosiwujm@gmail.com>"]
|
6
6
|
license = "MIT"
|
@@ -39,14 +39,14 @@ orjson = "*"
|
|
39
39
|
p115cipher = ">=0.0.3"
|
40
40
|
posixpatht = ">=0.0.3"
|
41
41
|
python-argtools = ">=0.0.1"
|
42
|
-
python-asynctools = ">=0.
|
42
|
+
python-asynctools = ">=0.1"
|
43
43
|
python-concurrenttools = ">=0.0.8.2"
|
44
44
|
python-cookietools = ">=0.0.2.1"
|
45
45
|
python-dictattr = ">=0.0.4"
|
46
46
|
python-encode_uri = ">=0.0.1"
|
47
|
-
python-filewrap = ">=0.2.
|
47
|
+
python-filewrap = ">=0.2.7.1"
|
48
48
|
python-hashtools = ">=0.0.3.3"
|
49
|
-
python-httpfile = ">=0.0.5"
|
49
|
+
python-httpfile = ">=0.0.5.1"
|
50
50
|
python-http_request = ">=0.0.6"
|
51
51
|
python-iterutils = ">=0.1.8"
|
52
52
|
python-property = ">=0.0.3"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|