p115client 0.0.5.8__tar.gz → 0.0.5.8.2__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.8 → p115client-0.0.5.8.2}/PKG-INFO +1 -1
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/p115client/client.py +65 -25
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/pyproject.toml +1 -1
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/LICENSE +0 -0
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/p115client/__init__.py +0 -0
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/p115client/_upload.py +0 -0
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/p115client/const.py +0 -0
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/p115client/exception.py +0 -0
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/p115client/py.typed +0 -0
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/p115client/tool/__init__.py +0 -0
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/p115client/tool/download.py +0 -0
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/p115client/tool/edit.py +0 -0
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/p115client/tool/export_dir.py +0 -0
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/p115client/tool/fs_files.py +0 -0
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/p115client/tool/iterdir.py +0 -0
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/p115client/tool/life.py +0 -0
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/p115client/tool/pool.py +0 -0
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/p115client/tool/request.py +0 -0
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/p115client/tool/upload.py +0 -0
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/p115client/tool/xys.py +0 -0
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/p115client/type.py +0 -0
- {p115client-0.0.5.8 → p115client-0.0.5.8.2}/readme.md +0 -0
@@ -17863,8 +17863,8 @@ class P115Client(P115OpenClient):
|
|
17863
17863
|
|
17864
17864
|
@overload
|
17865
17865
|
def share_skip_login_download_url(
|
17866
|
-
self,
|
17867
|
-
payload: int | str | dict,
|
17866
|
+
self: int | str | dict | P115Client,
|
17867
|
+
payload: None | int | str | dict = None,
|
17868
17868
|
/,
|
17869
17869
|
url: str = "",
|
17870
17870
|
strict: bool = True,
|
@@ -17877,8 +17877,8 @@ class P115Client(P115OpenClient):
|
|
17877
17877
|
...
|
17878
17878
|
@overload
|
17879
17879
|
def share_skip_login_download_url(
|
17880
|
-
self,
|
17881
|
-
payload: int | str | dict,
|
17880
|
+
self: int | str | dict | P115Client,
|
17881
|
+
payload: None | int | str | dict = None,
|
17882
17882
|
/,
|
17883
17883
|
url: str = "",
|
17884
17884
|
strict: bool = True,
|
@@ -17890,8 +17890,8 @@ class P115Client(P115OpenClient):
|
|
17890
17890
|
) -> Coroutine[Any, Any, P115URL]:
|
17891
17891
|
...
|
17892
17892
|
def share_skip_login_download_url(
|
17893
|
-
self,
|
17894
|
-
payload: int | str | dict,
|
17893
|
+
self: int | str | dict | P115Client,
|
17894
|
+
payload: None | int | str | dict = None,
|
17895
17895
|
/,
|
17896
17896
|
url: str = "",
|
17897
17897
|
strict: bool = True,
|
@@ -17903,6 +17903,9 @@ class P115Client(P115OpenClient):
|
|
17903
17903
|
) -> P115URL | Coroutine[Any, Any, P115URL]:
|
17904
17904
|
"""获取分享链接中某个文件的下载链接
|
17905
17905
|
|
17906
|
+
.. important::
|
17907
|
+
这个函数可以作为 staticmethod 使用,只要 `self` 不是 P115Client 类型,此时不需要登录
|
17908
|
+
|
17906
17909
|
:param payload: 请求参数,如果为 int 或 str,则视为 `file_id`
|
17907
17910
|
|
17908
17911
|
- file_id: int | str 💡 文件 id
|
@@ -17918,6 +17921,12 @@ class P115Client(P115OpenClient):
|
|
17918
17921
|
|
17919
17922
|
:return: 下载链接
|
17920
17923
|
"""
|
17924
|
+
if isinstance(self, P115Client):
|
17925
|
+
assert payload is not None
|
17926
|
+
inst: P115Client | type[P115Client] = self
|
17927
|
+
else:
|
17928
|
+
payload = self
|
17929
|
+
inst = __class__ # type: ignore
|
17921
17930
|
if isinstance(payload, (int, str)):
|
17922
17931
|
payload = {"file_id": payload}
|
17923
17932
|
else:
|
@@ -17928,9 +17937,9 @@ class P115Client(P115OpenClient):
|
|
17928
17937
|
payload["share_code"] = share_payload["share_code"]
|
17929
17938
|
payload["receive_code"] = share_payload["receive_code"] or ""
|
17930
17939
|
if use_web_api:
|
17931
|
-
resp =
|
17940
|
+
resp = inst.share_skip_login_download_url_web(payload, async_=async_, **request_kwargs)
|
17932
17941
|
else:
|
17933
|
-
resp =
|
17942
|
+
resp = inst.share_skip_login_download_url_app(payload, app=app, async_=async_, **request_kwargs)
|
17934
17943
|
def get_url(resp: dict, /) -> P115URL:
|
17935
17944
|
info = check_response(resp)["data"]
|
17936
17945
|
file_id = payload["file_id"]
|
@@ -17962,8 +17971,8 @@ class P115Client(P115OpenClient):
|
|
17962
17971
|
|
17963
17972
|
@overload
|
17964
17973
|
def share_skip_login_download_url_app(
|
17965
|
-
self,
|
17966
|
-
payload: dict,
|
17974
|
+
self: dict | P115Client,
|
17975
|
+
payload: None | dict = None,
|
17967
17976
|
/,
|
17968
17977
|
app: str = "",
|
17969
17978
|
base_url: bool | str | Callable[[], str] = False,
|
@@ -17974,8 +17983,8 @@ class P115Client(P115OpenClient):
|
|
17974
17983
|
...
|
17975
17984
|
@overload
|
17976
17985
|
def share_skip_login_download_url_app(
|
17977
|
-
self,
|
17978
|
-
payload: dict,
|
17986
|
+
self: dict | P115Client,
|
17987
|
+
payload: None | dict = None,
|
17979
17988
|
/,
|
17980
17989
|
app: str = "",
|
17981
17990
|
base_url: bool | str | Callable[[], str] = False,
|
@@ -17985,8 +17994,8 @@ class P115Client(P115OpenClient):
|
|
17985
17994
|
) -> Coroutine[Any, Any, dict]:
|
17986
17995
|
...
|
17987
17996
|
def share_skip_login_download_url_app(
|
17988
|
-
self,
|
17989
|
-
payload: dict,
|
17997
|
+
self: dict | P115Client,
|
17998
|
+
payload: None | dict = None,
|
17990
17999
|
/,
|
17991
18000
|
app: str = "",
|
17992
18001
|
base_url: bool | str | Callable[[], str] = False,
|
@@ -17996,16 +18005,22 @@ class P115Client(P115OpenClient):
|
|
17996
18005
|
) -> dict | Coroutine[Any, Any, dict]:
|
17997
18006
|
"""获取免登录下载链接
|
17998
18007
|
|
17999
|
-
POST https://proapi.115.com/app/share/
|
18008
|
+
POST https://proapi.115.com/app/share/skip_login_downurl
|
18009
|
+
|
18010
|
+
.. important::
|
18011
|
+
这个函数可以作为 staticmethod 使用,只要 `self` 不是 P115Client 类型,此时不需要登录
|
18000
18012
|
|
18001
18013
|
:payload:
|
18002
18014
|
- file_id: int | str
|
18003
18015
|
- receive_code: str
|
18004
18016
|
- share_code: str
|
18005
18017
|
"""
|
18018
|
+
if isinstance(self, dict):
|
18019
|
+
payload = self
|
18020
|
+
else:
|
18021
|
+
assert payload is not None
|
18006
18022
|
if app:
|
18007
18023
|
api = complete_proapi("/2.0/share/skip_login_downurl", base_url, app)
|
18008
|
-
return self.request(url=api, method="POST", data=payload, async_=async_, **request_kwargs)
|
18009
18024
|
else:
|
18010
18025
|
api = complete_proapi("/app/share/skip_login_downurl", base_url)
|
18011
18026
|
def parse(resp, content: bytes, /) -> dict:
|
@@ -18015,12 +18030,20 @@ class P115Client(P115OpenClient):
|
|
18015
18030
|
return resp
|
18016
18031
|
request_kwargs.setdefault("parse", parse)
|
18017
18032
|
payload = {"data": rsa_encode(dumps(payload)).decode()}
|
18033
|
+
if isinstance(self, P115Client):
|
18018
18034
|
return self.request(url=api, method="POST", data=payload, async_=async_, **request_kwargs)
|
18035
|
+
else:
|
18036
|
+
request_kwargs.setdefault("parse", default_parse)
|
18037
|
+
request = request_kwargs.pop("request", None)
|
18038
|
+
if request is None:
|
18039
|
+
return get_default_request()(url=api, method="POST", data=payload, async_=async_, **request_kwargs)
|
18040
|
+
else:
|
18041
|
+
return request(url=api, method="POST", data=payload, **request_kwargs)
|
18019
18042
|
|
18020
18043
|
@overload
|
18021
18044
|
def share_skip_login_download_url_web(
|
18022
|
-
self,
|
18023
|
-
payload: dict,
|
18045
|
+
self: dict | P115Client,
|
18046
|
+
payload: None | dict = None,
|
18024
18047
|
/,
|
18025
18048
|
base_url: bool | str | Callable[[], str] = False,
|
18026
18049
|
*,
|
@@ -18030,8 +18053,8 @@ class P115Client(P115OpenClient):
|
|
18030
18053
|
...
|
18031
18054
|
@overload
|
18032
18055
|
def share_skip_login_download_url_web(
|
18033
|
-
self,
|
18034
|
-
payload: dict,
|
18056
|
+
self: dict | P115Client,
|
18057
|
+
payload: None | dict = None,
|
18035
18058
|
/,
|
18036
18059
|
base_url: bool | str | Callable[[], str] = False,
|
18037
18060
|
*,
|
@@ -18040,8 +18063,8 @@ class P115Client(P115OpenClient):
|
|
18040
18063
|
) -> Coroutine[Any, Any, dict]:
|
18041
18064
|
...
|
18042
18065
|
def share_skip_login_download_url_web(
|
18043
|
-
self,
|
18044
|
-
payload: dict,
|
18066
|
+
self: dict | P115Client,
|
18067
|
+
payload: None | dict = None,
|
18045
18068
|
/,
|
18046
18069
|
base_url: bool | str | Callable[[], str] = False,
|
18047
18070
|
*,
|
@@ -18052,13 +18075,28 @@ class P115Client(P115OpenClient):
|
|
18052
18075
|
|
18053
18076
|
POST https://webapi.115.com/share/skip_login_downurl
|
18054
18077
|
|
18078
|
+
.. important::
|
18079
|
+
这个函数可以作为 staticmethod 使用,只要 `self` 不是 P115Client 类型,此时不需要登录
|
18080
|
+
|
18055
18081
|
:payload:
|
18056
18082
|
- share_code: str 💡 分享码
|
18057
18083
|
- receive_code: str 💡 接收码(访问密码)
|
18058
18084
|
- file_id: int | str 💡 文件 id
|
18059
18085
|
"""
|
18060
18086
|
api = complete_webapi("/share/skip_login_downurl", base_url=base_url)
|
18061
|
-
|
18087
|
+
if isinstance(self, dict):
|
18088
|
+
payload = self
|
18089
|
+
else:
|
18090
|
+
assert payload is not None
|
18091
|
+
if isinstance(self, P115Client):
|
18092
|
+
return self.request(url=api, method="POST", data=payload, async_=async_, **request_kwargs)
|
18093
|
+
else:
|
18094
|
+
request_kwargs.setdefault("parse", default_parse)
|
18095
|
+
request = request_kwargs.pop("request", None)
|
18096
|
+
if request is None:
|
18097
|
+
return get_default_request()(url=api, method="POST", data=payload, async_=async_, **request_kwargs)
|
18098
|
+
else:
|
18099
|
+
return request(url=api, method="POST", data=payload, **request_kwargs)
|
18062
18100
|
|
18063
18101
|
@overload
|
18064
18102
|
def share_skip_login_down_first(
|
@@ -18191,7 +18229,7 @@ class P115Client(P115OpenClient):
|
|
18191
18229
|
GET https://webapi.115.com/share/snap
|
18192
18230
|
|
18193
18231
|
.. important::
|
18194
|
-
这个函数可以作为 staticmethod 使用,只要 `self`
|
18232
|
+
这个函数可以作为 staticmethod 使用,只要 `self` 不是 P115Client 类型,此时不需要登录
|
18195
18233
|
|
18196
18234
|
否则,就是登录状态,但如果这个分享是你自己的,则可以不提供 receive_code,而且即使还在审核中,也能获取文件列表
|
18197
18235
|
|
@@ -18266,7 +18304,7 @@ class P115Client(P115OpenClient):
|
|
18266
18304
|
GET https://proapi.115.com/android/2.0/share/snap
|
18267
18305
|
|
18268
18306
|
.. important::
|
18269
|
-
这个函数可以作为 staticmethod 使用,只要 `self`
|
18307
|
+
这个函数可以作为 staticmethod 使用,只要 `self` 不是 P115Client 类型,此时不需要登录
|
18270
18308
|
|
18271
18309
|
否则,就是登录状态,但如果这个分享是你自己的,则可以不提供 receive_code,而且即使还在审核中,也能获取文件列表
|
18272
18310
|
|
@@ -20656,3 +20694,5 @@ for name, method in P115Client.__dict__.items():
|
|
20656
20694
|
CLIENT_API_MAP[match[1]] = "P115Client." + name
|
20657
20695
|
|
20658
20696
|
# TODO: 提供一个可随时终止和暂停的上传功能,并且可以输出进度条和获取进度
|
20697
|
+
# TODO: 更新一下,p115client._upload,做更多的封装,至少让断点续传更易于使用
|
20698
|
+
|
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
|
File without changes
|
File without changes
|
File without changes
|