p115client 0.0.5.6.9__py3-none-any.whl → 0.0.5.8__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/client.py CHANGED
@@ -3976,51 +3976,6 @@ class P115OpenClient(ClientRequestMixin):
3976
3976
  )
3977
3977
  return run_gen_step(gen_step, async_=async_)
3978
3978
 
3979
- @overload
3980
- def vip_qr_url(
3981
- self,
3982
- payload: dict,
3983
- /,
3984
- base_url: bool | str | Callable[[], str] = False,
3985
- *,
3986
- async_: Literal[False] = False,
3987
- **request_kwargs,
3988
- ) -> dict:
3989
- ...
3990
- @overload
3991
- def vip_qr_url(
3992
- self,
3993
- payload: dict,
3994
- /,
3995
- base_url: bool | str | Callable[[], str] = False,
3996
- *,
3997
- async_: Literal[True],
3998
- **request_kwargs,
3999
- ) -> Coroutine[Any, Any, dict]:
4000
- ...
4001
- def vip_qr_url(
4002
- self,
4003
- payload: dict,
4004
- /,
4005
- base_url: bool | str | Callable[[], str] = False,
4006
- *,
4007
- async_: Literal[False, True] = False,
4008
- **request_kwargs,
4009
- ) -> dict | Coroutine[Any, Any, dict]:
4010
- """获取开放平台产品列表
4011
-
4012
- GET https://proapi.115.com/open/vip/qr_url
4013
-
4014
- .. note::
4015
- https://www.yuque.com/115yun/open/yifbvxan6szytyng
4016
-
4017
- :payload:
4018
- - open_device: int | str 💡 设备号
4019
- - default_product_id: int | str 💡 默认产品ID
4020
- """
4021
- api = complete_proapi("/open/vip/qr_url", base_url)
4022
- return self.request(url=api, params=payload, async_=async_, **request_kwargs)
4023
-
4024
3979
  download_url_open = download_url
4025
3980
  download_url_info_open = download_url_info
4026
3981
  fs_copy_open = fs_copy
@@ -4040,7 +3995,6 @@ class P115OpenClient(ClientRequestMixin):
4040
3995
  user_info_open = user_info
4041
3996
  upload_file_init_open = upload_file_init
4042
3997
  upload_file_open = upload_file
4043
- vip_qr_url_open = vip_qr_url
4044
3998
 
4045
3999
 
4046
4000
  class P115Client(P115OpenClient):
@@ -17251,9 +17205,9 @@ class P115Client(P115OpenClient):
17251
17205
  return P115URL(
17252
17206
  url["url"] if url else "",
17253
17207
  id=int(info["fid"]),
17254
- sha1=info.get("sha1", ""),
17255
17208
  name=info["fn"],
17256
17209
  size=int(info["fs"]),
17210
+ sha1=info.get("sha1", ""),
17257
17211
  is_directory=not url,
17258
17212
  )
17259
17213
  if async_:
@@ -17585,11 +17539,11 @@ class P115Client(P115OpenClient):
17585
17539
  :payload:
17586
17540
  - share_code: str
17587
17541
  - receive_code: str
17588
- - file_id: int | str 💡 有多个时,用逗号 "," 分隔
17589
- - cid: int | str = <default> 💡 这是你网盘的目录 cid
17542
+ - file_id: int | str 💡 有多个时,用逗号 "," 分隔
17543
+ - cid: int | str = <default> 💡 这是你网盘的目录 cid
17544
+ - is_check: 0 | 1 = <default>
17590
17545
  """
17591
17546
  api = complete_webapi("/share/receive", base_url=base_url)
17592
- payload = {"cid": 0, **payload}
17593
17547
  return self.request(url=api, method="POST", data=payload, async_=async_, **request_kwargs)
17594
17548
 
17595
17549
  @overload
@@ -17633,11 +17587,11 @@ class P115Client(P115OpenClient):
17633
17587
  :payload:
17634
17588
  - share_code: str
17635
17589
  - receive_code: str
17636
- - file_id: int | str 💡 有多个时,用逗号 "," 分隔
17637
- - cid: int | str = <default> 💡 这是你网盘的目录 cid
17590
+ - file_id: int | str 💡 有多个时,用逗号 "," 分隔
17591
+ - cid: int | str = <default> 💡 这是你网盘的目录 cid
17592
+ - is_check: 0 | 1 = <default>
17638
17593
  """
17639
17594
  api = complete_proapi("/2.0/share/receive", base_url, app)
17640
- payload = {"cid": 0, **payload}
17641
17595
  return self.request(url=api, method="POST", data=payload, async_=async_, **request_kwargs)
17642
17596
 
17643
17597
  @overload
@@ -17793,7 +17747,7 @@ class P115Client(P115OpenClient):
17793
17747
  .. attention::
17794
17748
  最多只能取回前 10,000 条数据,也就是 limit + offset <= 10_000
17795
17749
 
17796
- :param payload:
17750
+ :payload:
17797
17751
  - share_code: str 💡 分享码
17798
17752
  - receive_code: str 💡 接收码(即密码)
17799
17753
  - cid: int | str = 0 💡 目录 id
@@ -17817,6 +17771,50 @@ class P115Client(P115OpenClient):
17817
17771
  payload = {"cid": 0, "limit": 32, "offset": 0, "search_value": ".", **payload}
17818
17772
  return self.request(url=api, params=payload, async_=async_, **request_kwargs)
17819
17773
 
17774
+ @overload
17775
+ def share_skip_login_check(
17776
+ self,
17777
+ payload: dict,
17778
+ /,
17779
+ base_url: bool | str | Callable[[], str] = False,
17780
+ *,
17781
+ async_: Literal[False] = False,
17782
+ **request_kwargs,
17783
+ ) -> dict:
17784
+ ...
17785
+ @overload
17786
+ def share_skip_login_check(
17787
+ self,
17788
+ payload: dict,
17789
+ /,
17790
+ base_url: bool | str | Callable[[], str] = False,
17791
+ *,
17792
+ async_: Literal[True],
17793
+ **request_kwargs,
17794
+ ) -> Coroutine[Any, Any, dict]:
17795
+ ...
17796
+ def share_skip_login_check(
17797
+ self,
17798
+ payload: dict,
17799
+ /,
17800
+ base_url: bool | str | Callable[[], str] = False,
17801
+ *,
17802
+ async_: Literal[False, True] = False,
17803
+ **request_kwargs,
17804
+ ) -> dict | Coroutine[Any, Any, dict]:
17805
+ """检查是否可免登录下载
17806
+
17807
+ POST https://webapi.115.com/share/is_skip_login
17808
+
17809
+ :payload:
17810
+ - share_code: str 💡 分享码
17811
+ - receive_code: str 💡 接收码(访问密码)
17812
+ - file_id: int | str = 1 💡 文件 id(可以随便填一个非 0 的值)
17813
+ """
17814
+ api = complete_webapi("/share/is_skip_login", base_url=base_url)
17815
+ payload.setdefault("file_id", 1)
17816
+ return self.request(url=api, method="POST", data=payload, async_=async_, **request_kwargs)
17817
+
17820
17818
  @overload
17821
17819
  def share_skip_login_down(
17822
17820
  self,
@@ -17852,7 +17850,7 @@ class P115Client(P115OpenClient):
17852
17850
 
17853
17851
  POST https://webapi.115.com/share/skip_login_down
17854
17852
 
17855
- :param payload:
17853
+ :payload:
17856
17854
  - share_code: str 💡 分享码
17857
17855
  - skip_login: 0 | 1 = 1 💡 是否开启
17858
17856
  """
@@ -17863,6 +17861,248 @@ class P115Client(P115OpenClient):
17863
17861
  payload = {"skip_login": 1, **payload}
17864
17862
  return self.request(url=api, method="POST", data=payload, async_=async_, **request_kwargs)
17865
17863
 
17864
+ @overload
17865
+ def share_skip_login_download_url(
17866
+ self,
17867
+ payload: int | str | dict,
17868
+ /,
17869
+ url: str = "",
17870
+ strict: bool = True,
17871
+ use_web_api: bool = False,
17872
+ app: str = "",
17873
+ *,
17874
+ async_: Literal[False] = False,
17875
+ **request_kwargs,
17876
+ ) -> P115URL:
17877
+ ...
17878
+ @overload
17879
+ def share_skip_login_download_url(
17880
+ self,
17881
+ payload: int | str | dict,
17882
+ /,
17883
+ url: str = "",
17884
+ strict: bool = True,
17885
+ use_web_api: bool = False,
17886
+ app: str = "",
17887
+ *,
17888
+ async_: Literal[True],
17889
+ **request_kwargs,
17890
+ ) -> Coroutine[Any, Any, P115URL]:
17891
+ ...
17892
+ def share_skip_login_download_url(
17893
+ self,
17894
+ payload: int | str | dict,
17895
+ /,
17896
+ url: str = "",
17897
+ strict: bool = True,
17898
+ use_web_api: bool = False,
17899
+ app: str = "",
17900
+ *,
17901
+ async_: Literal[False, True] = False,
17902
+ **request_kwargs,
17903
+ ) -> P115URL | Coroutine[Any, Any, P115URL]:
17904
+ """获取分享链接中某个文件的下载链接
17905
+
17906
+ :param payload: 请求参数,如果为 int 或 str,则视为 `file_id`
17907
+
17908
+ - file_id: int | str 💡 文件 id
17909
+ - receive_code: str 💡 接收码(访问密码)
17910
+ - share_code: str 💡 分享码
17911
+
17912
+ :param url: 分享链接,如果提供的话,会被拆解并合并到 `payload` 中,优先级较高
17913
+ :param strict: 如果为 True,当目标是目录时,会抛出 IsADirectoryError 异常
17914
+ :param use_web_api: 是否使用网页版接口执行请求(优先级高于 `app`)
17915
+ :param app: 使用此设备的接口
17916
+ :param async_: 是否异步
17917
+ :param request_kwargs: 其它请求参数
17918
+
17919
+ :return: 下载链接
17920
+ """
17921
+ if isinstance(payload, (int, str)):
17922
+ payload = {"file_id": payload}
17923
+ else:
17924
+ payload = dict(payload)
17925
+ if url:
17926
+ from .tool import share_extract_payload
17927
+ share_payload = share_extract_payload(url)
17928
+ payload["share_code"] = share_payload["share_code"]
17929
+ payload["receive_code"] = share_payload["receive_code"] or ""
17930
+ if use_web_api:
17931
+ resp = self.share_skip_login_download_url_web(payload, async_=async_, **request_kwargs)
17932
+ else:
17933
+ resp = self.share_skip_login_download_url_app(payload, app=app, async_=async_, **request_kwargs)
17934
+ def get_url(resp: dict, /) -> P115URL:
17935
+ info = check_response(resp)["data"]
17936
+ file_id = payload["file_id"]
17937
+ if not info:
17938
+ raise FileNotFoundError(
17939
+ errno.ENOENT,
17940
+ f"no such id: {file_id!r}, with response {resp}",
17941
+ )
17942
+ url = info["url"]
17943
+ if strict and not url:
17944
+ raise IsADirectoryError(
17945
+ errno.EISDIR,
17946
+ f"{file_id} is a directory, with response {resp}",
17947
+ )
17948
+ return P115URL(
17949
+ url["url"] if url else "",
17950
+ id=int(info["fid"]),
17951
+ name=info["fn"],
17952
+ size=int(info["fs"]),
17953
+ sha1=info.get("sha1", ""),
17954
+ is_directory=not url,
17955
+ )
17956
+ if async_:
17957
+ async def async_request() -> P115URL:
17958
+ return get_url(await cast(Coroutine[Any, Any, dict], resp))
17959
+ return async_request()
17960
+ else:
17961
+ return get_url(cast(dict, resp))
17962
+
17963
+ @overload
17964
+ def share_skip_login_download_url_app(
17965
+ self,
17966
+ payload: dict,
17967
+ /,
17968
+ app: str = "",
17969
+ base_url: bool | str | Callable[[], str] = False,
17970
+ *,
17971
+ async_: Literal[False] = False,
17972
+ **request_kwargs,
17973
+ ) -> dict:
17974
+ ...
17975
+ @overload
17976
+ def share_skip_login_download_url_app(
17977
+ self,
17978
+ payload: dict,
17979
+ /,
17980
+ app: str = "",
17981
+ base_url: bool | str | Callable[[], str] = False,
17982
+ *,
17983
+ async_: Literal[True],
17984
+ **request_kwargs,
17985
+ ) -> Coroutine[Any, Any, dict]:
17986
+ ...
17987
+ def share_skip_login_download_url_app(
17988
+ self,
17989
+ payload: dict,
17990
+ /,
17991
+ app: str = "",
17992
+ base_url: bool | str | Callable[[], str] = False,
17993
+ *,
17994
+ async_: Literal[False, True] = False,
17995
+ **request_kwargs,
17996
+ ) -> dict | Coroutine[Any, Any, dict]:
17997
+ """获取免登录下载链接
17998
+
17999
+ POST https://proapi.115.com/app/share/downurl
18000
+
18001
+ :payload:
18002
+ - file_id: int | str
18003
+ - receive_code: str
18004
+ - share_code: str
18005
+ """
18006
+ if app:
18007
+ 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
+ else:
18010
+ api = complete_proapi("/app/share/skip_login_downurl", base_url)
18011
+ def parse(resp, content: bytes, /) -> dict:
18012
+ resp = json_loads(content)
18013
+ if resp["state"]:
18014
+ resp["data"] = json_loads(rsa_decode(resp["data"]))
18015
+ return resp
18016
+ request_kwargs.setdefault("parse", parse)
18017
+ payload = {"data": rsa_encode(dumps(payload)).decode()}
18018
+ return self.request(url=api, method="POST", data=payload, async_=async_, **request_kwargs)
18019
+
18020
+ @overload
18021
+ def share_skip_login_download_url_web(
18022
+ self,
18023
+ payload: dict,
18024
+ /,
18025
+ base_url: bool | str | Callable[[], str] = False,
18026
+ *,
18027
+ async_: Literal[False] = False,
18028
+ **request_kwargs,
18029
+ ) -> dict:
18030
+ ...
18031
+ @overload
18032
+ def share_skip_login_download_url_web(
18033
+ self,
18034
+ payload: dict,
18035
+ /,
18036
+ base_url: bool | str | Callable[[], str] = False,
18037
+ *,
18038
+ async_: Literal[True],
18039
+ **request_kwargs,
18040
+ ) -> Coroutine[Any, Any, dict]:
18041
+ ...
18042
+ def share_skip_login_download_url_web(
18043
+ self,
18044
+ payload: dict,
18045
+ /,
18046
+ base_url: bool | str | Callable[[], str] = False,
18047
+ *,
18048
+ async_: Literal[False, True] = False,
18049
+ **request_kwargs,
18050
+ ) -> dict | Coroutine[Any, Any, dict]:
18051
+ """获取免登录下载链接
18052
+
18053
+ POST https://webapi.115.com/share/skip_login_downurl
18054
+
18055
+ :payload:
18056
+ - share_code: str 💡 分享码
18057
+ - receive_code: str 💡 接收码(访问密码)
18058
+ - file_id: int | str 💡 文件 id
18059
+ """
18060
+ api = complete_webapi("/share/skip_login_downurl", base_url=base_url)
18061
+ return self.request(url=api, method="POST", data=payload, async_=async_, **request_kwargs)
18062
+
18063
+ @overload
18064
+ def share_skip_login_down_first(
18065
+ self,
18066
+ payload: str | dict,
18067
+ /,
18068
+ base_url: bool | str | Callable[[], str] = False,
18069
+ *,
18070
+ async_: Literal[False] = False,
18071
+ **request_kwargs,
18072
+ ) -> dict:
18073
+ ...
18074
+ @overload
18075
+ def share_skip_login_down_first(
18076
+ self,
18077
+ payload: str | dict,
18078
+ /,
18079
+ base_url: bool | str | Callable[[], str] = False,
18080
+ *,
18081
+ async_: Literal[True],
18082
+ **request_kwargs,
18083
+ ) -> Coroutine[Any, Any, dict]:
18084
+ ...
18085
+ def share_skip_login_down_first(
18086
+ self,
18087
+ payload: str | dict,
18088
+ /,
18089
+ base_url: bool | str | Callable[[], str] = False,
18090
+ *,
18091
+ async_: Literal[False, True] = False,
18092
+ **request_kwargs,
18093
+ ) -> dict | Coroutine[Any, Any, dict]:
18094
+ """免登录下载信息
18095
+
18096
+ GET https://webapi.115.com/share/skip_login_down_first
18097
+
18098
+ :payload:
18099
+ - share_code: str 💡 分享码
18100
+ """
18101
+ api = complete_webapi("/share/skip_login_down_first", base_url=base_url)
18102
+ if isinstance(payload, str):
18103
+ payload = {"share_code": payload}
18104
+ return self.request(url=api, params=payload, async_=async_, **request_kwargs)
18105
+
17866
18106
  @overload
17867
18107
  def share_skip_login_down_details(
17868
18108
  self,
@@ -17898,7 +18138,7 @@ class P115Client(P115OpenClient):
17898
18138
 
17899
18139
  GET https://webapi.115.com/share/skip_login_down_details
17900
18140
 
17901
- :param payload:
18141
+ :payload:
17902
18142
  - start_time: str = <default> 💡 开始时间,格式为 "YYYY-MM-DD hh:mm:ss",默认为今天零点
17903
18143
  - end_time: str = <default> 💡 结束时间(含),默认为明天零点
17904
18144
  - share_code: str = "" 💡 分享码,如果为空则统计所有分享
@@ -17916,11 +18156,10 @@ class P115Client(P115OpenClient):
17916
18156
  return self.request(url=api, params=payload, async_=async_, **request_kwargs)
17917
18157
 
17918
18158
  @overload
17919
- @staticmethod
17920
18159
  def share_snap(
17921
- payload: dict,
18160
+ self: dict | P115Client,
18161
+ payload: None | dict = None,
17922
18162
  /,
17923
- request: None | Callable = None,
17924
18163
  base_url: bool | str | Callable[[], str] = False,
17925
18164
  *,
17926
18165
  async_: Literal[False] = False,
@@ -17928,22 +18167,20 @@ class P115Client(P115OpenClient):
17928
18167
  ) -> dict:
17929
18168
  ...
17930
18169
  @overload
17931
- @staticmethod
17932
18170
  def share_snap(
17933
- payload: dict,
18171
+ self: dict | P115Client,
18172
+ payload: None | dict = None,
17934
18173
  /,
17935
- request: None | Callable = None,
17936
18174
  base_url: bool | str | Callable[[], str] = False,
17937
18175
  *,
17938
18176
  async_: Literal[True],
17939
18177
  **request_kwargs,
17940
18178
  ) -> Coroutine[Any, Any, dict]:
17941
18179
  ...
17942
- @staticmethod
17943
18180
  def share_snap(
17944
- payload: dict,
18181
+ self: dict | P115Client,
18182
+ payload: None | dict = None,
17945
18183
  /,
17946
- request: None | Callable = None,
17947
18184
  base_url: bool | str | Callable[[], str] = False,
17948
18185
  *,
17949
18186
  async_: Literal[False, True] = False,
@@ -17953,6 +18190,11 @@ class P115Client(P115OpenClient):
17953
18190
 
17954
18191
  GET https://webapi.115.com/share/snap
17955
18192
 
18193
+ .. important::
18194
+ 这个函数可以作为 staticmethod 使用,只要 `self` 为 dict 类型,此时不需要登录
18195
+
18196
+ 否则,就是登录状态,但如果这个分享是你自己的,则可以不提供 receive_code,而且即使还在审核中,也能获取文件列表
18197
+
17956
18198
  :payload:
17957
18199
  - share_code: str
17958
18200
  - receive_code: str
@@ -17967,17 +18209,25 @@ class P115Client(P115OpenClient):
17967
18209
  - "user_ptime": 创建时间/修改时间
17968
18210
  """
17969
18211
  api = complete_webapi("/share/snap", base_url=base_url)
18212
+ if isinstance(self, dict):
18213
+ payload = self
18214
+ else:
18215
+ assert payload is not None
17970
18216
  payload = {"cid": 0, "limit": 32, "offset": 0, **payload}
17971
- request_kwargs.setdefault("parse", default_parse)
17972
- if request is None:
17973
- return get_default_request()(url=api, params=payload, async_=async_, **request_kwargs)
18217
+ if isinstance(self, P115Client):
18218
+ return self.request(url=api, params=payload, async_=async_, **request_kwargs)
17974
18219
  else:
17975
- return request(url=api, params=payload, **request_kwargs)
18220
+ request_kwargs.setdefault("parse", default_parse)
18221
+ request = request_kwargs.pop("request", None)
18222
+ if request is None:
18223
+ return get_default_request()(url=api, params=payload, async_=async_, **request_kwargs)
18224
+ else:
18225
+ return request(url=api, params=payload, **request_kwargs)
17976
18226
 
17977
18227
  @overload
17978
- @staticmethod
17979
18228
  def share_snap_app(
17980
- payload: dict,
18229
+ self: dict | P115Client,
18230
+ payload: None | dict = None,
17981
18231
  /,
17982
18232
  request: None | Callable = None,
17983
18233
  app: str = "android",
@@ -17988,9 +18238,9 @@ class P115Client(P115OpenClient):
17988
18238
  ) -> dict:
17989
18239
  ...
17990
18240
  @overload
17991
- @staticmethod
17992
18241
  def share_snap_app(
17993
- payload: dict,
18242
+ self: dict | P115Client,
18243
+ payload: None | dict = None,
17994
18244
  /,
17995
18245
  request: None | Callable = None,
17996
18246
  app: str = "android",
@@ -18000,9 +18250,9 @@ class P115Client(P115OpenClient):
18000
18250
  **request_kwargs,
18001
18251
  ) -> Coroutine[Any, Any, dict]:
18002
18252
  ...
18003
- @staticmethod
18004
18253
  def share_snap_app(
18005
- payload: dict,
18254
+ self: dict | P115Client,
18255
+ payload: None | dict = None,
18006
18256
  /,
18007
18257
  request: None | Callable = None,
18008
18258
  app: str = "android",
@@ -18015,6 +18265,11 @@ class P115Client(P115OpenClient):
18015
18265
 
18016
18266
  GET https://proapi.115.com/android/2.0/share/snap
18017
18267
 
18268
+ .. important::
18269
+ 这个函数可以作为 staticmethod 使用,只要 `self` 为 dict 类型,此时不需要登录
18270
+
18271
+ 否则,就是登录状态,但如果这个分享是你自己的,则可以不提供 receive_code,而且即使还在审核中,也能获取文件列表
18272
+
18018
18273
  :payload:
18019
18274
  - share_code: str
18020
18275
  - receive_code: str
@@ -18029,12 +18284,20 @@ class P115Client(P115OpenClient):
18029
18284
  - "user_ptime": 创建时间/修改时间
18030
18285
  """
18031
18286
  api = complete_proapi("/2.0/share/snap", base_url, app)
18287
+ if isinstance(self, dict):
18288
+ payload = self
18289
+ else:
18290
+ assert payload is not None
18032
18291
  payload = {"cid": 0, "limit": 32, "offset": 0, **payload}
18033
- request_kwargs.setdefault("parse", default_parse)
18034
- if request is None:
18035
- return get_default_request()(url=api, params=payload, async_=async_, **request_kwargs)
18292
+ if isinstance(self, P115Client):
18293
+ return self.request(url=api, params=payload, async_=async_, **request_kwargs)
18036
18294
  else:
18037
- return request(url=api, params=payload, **request_kwargs)
18295
+ request_kwargs.setdefault("parse", default_parse)
18296
+ request = request_kwargs.pop("request", None)
18297
+ if request is None:
18298
+ return get_default_request()(url=api, params=payload, async_=async_, **request_kwargs)
18299
+ else:
18300
+ return request(url=api, params=payload, **request_kwargs)
18038
18301
 
18039
18302
  @overload
18040
18303
  def share_update(
@@ -18073,14 +18336,16 @@ class P115Client(P115OpenClient):
18073
18336
 
18074
18337
  :payload:
18075
18338
  - share_code: str
18076
- - receive_code: str = <default> 💡 访问密码(口令)
18077
- - share_duration: int = <default> 💡 分享天数: 1(1天), 7(7天), -1(长期)
18339
+ - receive_code: str = <default> 💡 接收码(访问密码)
18340
+ - share_duration: int = <default> 💡 分享天数: n(填入指定天数),-1(长期)
18078
18341
  - is_custom_code: 0 | 1 = <default> 💡 用户自定义口令(不用管)
18079
18342
  - auto_fill_recvcode: 0 | 1 = <default> 💡 分享链接自动填充口令(不用管)
18080
18343
  - share_channel: int = <default> 💡 分享渠道代码(不用管)
18081
18344
  - action: str = <default> 💡 操作: 取消分享 "cancel"
18082
18345
  - skip_login_down_flow_limit: "" | int = <default> 💡 设置免登录下载限制流量,如果为 "" 则不限,单位: 字节
18083
18346
  - access_user_ids = int | str = <default> 💡 设置访问账号,多个用逗号 "," 隔开
18347
+ - receive_user_limit: int = <default> 💡 接收次数
18348
+ - reset_receive_user: 0 | 1 = <default> 💡 重置接收次数
18084
18349
  """
18085
18350
  api = complete_webapi("/share/updateshare", base_url=base_url)
18086
18351
  return self.request(url=api, method="POST", data=payload, async_=async_, **request_kwargs)
@@ -18125,14 +18390,16 @@ class P115Client(P115OpenClient):
18125
18390
 
18126
18391
  :payload:
18127
18392
  - share_code: str
18128
- - receive_code: str = <default> 💡 访问密码(口令)
18129
- - share_duration: int = <default> 💡 分享天数: 1(1天), 7(7天), -1(长期)
18393
+ - receive_code: str = <default> 💡 接收码(访问密码)
18394
+ - share_duration: int = <default> 💡 分享天数: n(填入指定天数),-1(长期)
18130
18395
  - is_custom_code: 0 | 1 = <default> 💡 用户自定义口令(不用管)
18131
18396
  - auto_fill_recvcode: 0 | 1 = <default> 💡 分享链接自动填充口令(不用管)
18132
18397
  - share_channel: int = <default> 💡 分享渠道代码(不用管)
18133
18398
  - action: str = <default> 💡 操作: 取消分享 "cancel"
18134
18399
  - skip_login_down_flow_limit: "" | int = <default> 💡 设置免登录下载限制流量,如果为 "" 则不限,单位: 字节
18135
18400
  - access_user_ids = int | str = <default> 💡 设置访问账号,多个用逗号 "," 隔开
18401
+ - receive_user_limit: int = <default> 💡 接收次数
18402
+ - reset_receive_user: 0 | 1 = <default> 💡 重置接收次数
18136
18403
  """
18137
18404
  api = complete_proapi("/2.0/share/updateshare", base_url, app)
18138
18405
  return self.request(url=api, method="POST", data=payload, async_=async_, **request_kwargs)
@@ -97,7 +97,7 @@ def batch_get_url(
97
97
 
98
98
  :return: 字典,key 是文件 id,value 是下载链接,自动忽略所有无效项目
99
99
  """
100
- if not isinstance(client, P115Client):
100
+ if isinstance(client, str):
101
101
  client = P115Client(client, check_for_relogin=True)
102
102
  if headers := request_kwargs.get("headers"):
103
103
  request_kwargs["headers"] = dict(headers, **{"User-Agent": user_agent})
@@ -207,7 +207,7 @@ def iter_url_batches(
207
207
 
208
208
  :return: 字典,key 是文件 id,value 是下载链接,自动忽略所有无效项目
209
209
  """
210
- if not isinstance(client, P115Client):
210
+ if isinstance(client, str):
211
211
  client = P115Client(client, check_for_relogin=True)
212
212
  if headers := request_kwargs.get("headers"):
213
213
  request_kwargs["headers"] = dict(headers, **{"User-Agent": user_agent})
@@ -342,7 +342,7 @@ def iter_files_with_url(
342
342
 
343
343
  :return: 迭代器,产生文件信息,并增加一个 "url" 作为下载链接
344
344
  """
345
- if not isinstance(client, P115Client):
345
+ if isinstance(client, str):
346
346
  client = P115Client(client, check_for_relogin=True)
347
347
  params = dict(
348
348
  cur=cur,
@@ -494,7 +494,7 @@ def iter_images_with_url(
494
494
 
495
495
  :return: 迭代器,产生文件信息,并增加一个 "url" 作为下载链接
496
496
  """
497
- if not isinstance(client, P115Client):
497
+ if isinstance(client, str):
498
498
  client = P115Client(client, check_for_relogin=True)
499
499
  params = dict(
500
500
  cur=cur,
@@ -654,7 +654,7 @@ def iter_subtitles_with_url(
654
654
 
655
655
  :return: 迭代器,产生文件信息,并增加一个 "url" 作为下载链接
656
656
  """
657
- if not isinstance(client, P115Client):
657
+ if isinstance(client, str):
658
658
  client = P115Client(client, check_for_relogin=True)
659
659
  def gen_step():
660
660
  nonlocal suffixes
@@ -791,7 +791,7 @@ def iter_subtitle_batches(
791
791
 
792
792
  :return: 迭代器,产生文件信息,并增加一个 "url" 作为下载链接,文件信息中的 file_id 是复制所得的文件信息,不是原来文件的 id
793
793
  """
794
- if not isinstance(client, P115Client):
794
+ if isinstance(client, str):
795
795
  client = P115Client(client, check_for_relogin=True)
796
796
  if batch_size <= 0:
797
797
  batch_size = 1_000
@@ -953,7 +953,7 @@ def make_strm(
953
953
  :param async_: 是否异步
954
954
  :param request_kwargs: 其它请求参数
955
955
  """
956
- if not isinstance(client, P115Client):
956
+ if isinstance(client, str):
957
957
  client = P115Client(client, check_for_relogin=True)
958
958
  user_id = client.user_id
959
959
  origin = origin.rstrip("/")
@@ -1128,7 +1128,7 @@ def iter_download_nodes(
1128
1128
 
1129
1129
  :return: 迭代器,产生文件或者目录的简略信息
1130
1130
  """
1131
- if not isinstance(client, P115Client):
1131
+ if isinstance(client, str):
1132
1132
  client = P115Client(client, check_for_relogin=True)
1133
1133
  if files:
1134
1134
  method = client.download_files
@@ -1296,7 +1296,7 @@ def iter_download_files(
1296
1296
 
1297
1297
  :return: 迭代器,产生文件的简略信息
1298
1298
  """
1299
- if not isinstance(client, P115Client):
1299
+ if isinstance(client, str):
1300
1300
  client = P115Client(client, check_for_relogin=True)
1301
1301
  if id_to_dirnode is None:
1302
1302
  id_to_dirnode = ID_TO_DIRNODE_CACHE[client.user_id]
p115client/tool/edit.py CHANGED
@@ -70,7 +70,7 @@ def update_abstract(
70
70
  :param async_: 是否异步
71
71
  :param request_kwargs: 其它请求参数
72
72
  """
73
- if not isinstance(client, P115Client):
73
+ if isinstance(client, str):
74
74
  client = P115Client(client, check_for_relogin=True)
75
75
  if max_workers is None or max_workers <= 0:
76
76
  max_workers = 20 if async_ else None
@@ -559,7 +559,7 @@ def batch_unstar(
559
559
  :param async_: 是否异步
560
560
  :param request_kwargs: 其它请求参数
561
561
  """
562
- if not isinstance(client, P115Client):
562
+ if isinstance(client, str):
563
563
  client = P115Client(client, check_for_relogin=True)
564
564
  def get_id(info: dict, /) -> int:
565
565
  for k in ("file_id", "category_id", "fid", "cid"):
@@ -493,7 +493,7 @@ def export_dir_result(
493
493
  def export_dir_parse_iter(
494
494
  client: str | P115Client,
495
495
  export_file_ids: int | str | Iterable[int | str] = 0,
496
- export_id: int = 0,
496
+ export_id: int | str = 0,
497
497
  target_pid: int | str = 0,
498
498
  layer_limit: int = 0,
499
499
  parse_iter: None | Callable[[IO[bytes]], Iterator] = None,
@@ -511,7 +511,7 @@ def export_dir_parse_iter(
511
511
  def export_dir_parse_iter(
512
512
  client: str | P115Client,
513
513
  export_file_ids: int | str | Iterable[int | str] = 0,
514
- export_id: int = 0,
514
+ export_id: int | str = 0,
515
515
  target_pid: int | str = 0,
516
516
  layer_limit: int = 0,
517
517
  parse_iter: None | Callable[[IO[bytes]], AsyncIterator] = None,
@@ -528,7 +528,7 @@ def export_dir_parse_iter(
528
528
  def export_dir_parse_iter(
529
529
  client: str | P115Client,
530
530
  export_file_ids: int | str | Iterable[int | str] = 0,
531
- export_id: int = 0,
531
+ export_id: int | str = 0,
532
532
  target_pid: int | str = 0,
533
533
  layer_limit: int = 0,
534
534
  parse_iter: None | Callable[[IO[bytes]], Iterator] | Callable[[IO[bytes]], AsyncIterator] = None,
@@ -545,11 +545,11 @@ def export_dir_parse_iter(
545
545
 
546
546
  :param client: 115 客户端或 cookies
547
547
  :param export_file_ids: 待导出的目录 id 或 路径(如果有多个,需传入可迭代对象)
548
- :param export_id: 优先级高于 `export_file_ids`,之前提交的 `export_dir` 任务的 id
548
+ :param export_id: 优先级高于 `export_file_ids`,之前提交的 `export_dir` 任务的 id,如果是 str,则视为导出的目录树文件的提取码(因此无需导出)
549
549
  :param target_pid: 导出到的目标目录 id 或 路径
550
550
  :param layer_limit: 层级深度,小于等于 0 时不限
551
551
  :param parse_iter: 解析打开的二进制文件,返回可迭代对象
552
- :param delete: 最终删除目录树文件
552
+ :param delete: 最终删除目录树文件(如果 export_id 为 str(即提取码),则这个值不生效,必不删除)
553
553
  :param timeout: 导出任务的超时秒数,如果为 None 或 小于等于 0,则相当于 float("inf"),即永不超时
554
554
  :param check_interval: 导出任务的状态,两次轮询之间的等待秒数,如果 <= 0,则不等待
555
555
  :param show_clock: 是否在等待导出目录树时,显示时钟。如果为 True,则显示默认的时钟,如果为 Callable,则作为自定义时钟进行调用(无参数)
@@ -577,37 +577,42 @@ def export_dir_parse_iter(
577
577
  async_=async_,
578
578
  **request_kwargs,
579
579
  )
580
- if not show_clock:
581
- result: dict = yield export_dir_result(
582
- client,
583
- export_id,
584
- timeout=timeout,
585
- check_interval=check_interval,
586
- async_=async_,
587
- **request_kwargs,
588
- )
589
- else:
590
- result = yield context(
591
- lambda *a: export_dir_result(
580
+ if isinstance(export_id, int):
581
+ if not show_clock:
582
+ result: dict = yield export_dir_result(
592
583
  client,
593
584
  export_id,
594
585
  timeout=timeout,
595
586
  check_interval=check_interval,
596
587
  async_=async_,
597
588
  **request_kwargs,
598
- ),
599
- backgroud_loop(
600
- None if show_clock is True else show_clock,
601
- interval=clock_interval,
589
+ )
590
+ else:
591
+ result = yield context(
592
+ lambda *a: export_dir_result(
593
+ client,
594
+ export_id,
595
+ timeout=timeout,
596
+ check_interval=check_interval,
597
+ async_=async_,
598
+ **request_kwargs,
599
+ ),
600
+ backgroud_loop(
601
+ None if show_clock is True else show_clock,
602
+ interval=clock_interval,
603
+ async_=async_, # type: ignore
604
+ ),
602
605
  async_=async_, # type: ignore
603
- ),
604
- async_=async_, # type: ignore
605
- )
606
+ )
607
+ pickcode = result["pick_code"]
608
+ else:
609
+ pickcode = export_id
610
+ delete = False
606
611
  try:
607
612
  try:
608
613
  url: str = yield partial(
609
614
  client.download_url,
610
- result["pick_code"],
615
+ pickcode,
611
616
  use_web_api=True,
612
617
  async_=async_,
613
618
  **request_kwargs,
@@ -615,7 +620,7 @@ def export_dir_parse_iter(
615
620
  except OSError:
616
621
  url = yield partial(
617
622
  client.download_url,
618
- result["pick_code"],
623
+ pickcode,
619
624
  async_=async_,
620
625
  **request_kwargs,
621
626
  )
@@ -266,7 +266,7 @@ def get_path_to_cid(
266
266
 
267
267
  :return: 目录对应的绝对路径或相对路径
268
268
  """
269
- if not isinstance(client, P115Client):
269
+ if isinstance(client, str):
270
270
  client = P115Client(client, check_for_relogin=True)
271
271
  if isinstance(escape, bool):
272
272
  if escape:
@@ -349,7 +349,7 @@ def get_file_count(
349
349
 
350
350
  :return: 目录内的文件总数(不包括目录)
351
351
  """
352
- if not isinstance(client, P115Client):
352
+ if isinstance(client, str):
353
353
  client = P115Client(client, check_for_relogin=True)
354
354
  if id_to_dirnode is None:
355
355
  id_to_dirnode = ID_TO_DIRNODE_CACHE[client.user_id]
@@ -481,7 +481,7 @@ def get_ancestors(
481
481
  "name": str, # 名字
482
482
  }
483
483
  """
484
- if not isinstance(client, P115Client):
484
+ if isinstance(client, str):
485
485
  client = P115Client(client, check_for_relogin=True)
486
486
  if id_to_dirnode is None:
487
487
  id_to_dirnode = ID_TO_DIRNODE_CACHE[client.user_id]
@@ -626,7 +626,7 @@ def get_ancestors_to_cid(
626
626
  "name": str, # 名字
627
627
  }
628
628
  """
629
- if not isinstance(client, P115Client):
629
+ if isinstance(client, str):
630
630
  client = P115Client(client, check_for_relogin=True)
631
631
  if id_to_dirnode is None:
632
632
  id_to_dirnode = ID_TO_DIRNODE_CACHE[client.user_id]
@@ -723,7 +723,7 @@ def get_id_to_path(
723
723
 
724
724
  :return: 文件或目录的 id
725
725
  """
726
- if not isinstance(client, P115Client):
726
+ if isinstance(client, str):
727
727
  client = P115Client(client, check_for_relogin=True)
728
728
  if id_to_dirnode is None:
729
729
  id_to_dirnode = ID_TO_DIRNODE_CACHE[client.user_id]
@@ -931,7 +931,7 @@ def get_id_to_pickcode(
931
931
  ) -> P115ID | Coroutine[Any, Any, P115ID]:
932
932
  if not 17 <= len(pickcode) <= 18 or not pickcode.isalnum():
933
933
  raise ValueError(f"bad pickcode: {pickcode!r}")
934
- if not isinstance(client, P115Client):
934
+ if isinstance(client, str):
935
935
  client = P115Client(client, check_for_relogin=True)
936
936
  def gen_step():
937
937
  resp = yield client.download_url_web(pickcode, base_url=True, async_=async_, **request_kwargs)
@@ -970,7 +970,7 @@ def get_id_to_sha1(
970
970
  ) -> P115ID | Coroutine[Any, Any, P115ID]:
971
971
  if len(sha1) != 40 or sha1.strip(hexdigits):
972
972
  raise ValueError(f"bad sha1: {sha1!r}")
973
- if not isinstance(client, P115Client):
973
+ if isinstance(client, str):
974
974
  client = P115Client(client, check_for_relogin=True)
975
975
  def gen_step():
976
976
  resp = yield client.fs_shasearch(sha1, base_url=True, async_=async_, **request_kwargs)
@@ -1018,7 +1018,7 @@ def iter_nodes_skim(
1018
1018
 
1019
1019
  :return: 迭代器,获取节点的简略信息
1020
1020
  """
1021
- if not isinstance(client, P115Client):
1021
+ if isinstance(client, str):
1022
1022
  client = P115Client(client, check_for_relogin=True)
1023
1023
  def gen_step():
1024
1024
  file_skim = client.fs_file_skim
@@ -1119,7 +1119,7 @@ def _iter_fs_files(
1119
1119
  payload["nf"] = 1
1120
1120
  if payload.get("type") == 99:
1121
1121
  payload.pop("type", None)
1122
- if not isinstance(client, P115Client):
1122
+ if isinstance(client, str):
1123
1123
  client = P115Client(client, check_for_relogin=True)
1124
1124
  if id_to_dirnode is None:
1125
1125
  id_to_dirnode = ID_TO_DIRNODE_CACHE[client.user_id]
@@ -1457,7 +1457,7 @@ def ensure_attr_path[D: dict](
1457
1457
  return iter(attrs)
1458
1458
  if make_up_missing and not isinstance(attrs, Collection):
1459
1459
  attrs = tuple(attrs)
1460
- if not isinstance(client, P115Client):
1460
+ if isinstance(client, str):
1461
1461
  client = P115Client(client, check_for_relogin=True)
1462
1462
  if page_size <= 0:
1463
1463
  page_size = 10_000
@@ -1638,7 +1638,7 @@ def ensure_attr_path_by_category_get[D: dict](
1638
1638
  if async_:
1639
1639
  return ensure_aiter(attrs)
1640
1640
  return attrs # type: ignore
1641
- if not isinstance(client, P115Client):
1641
+ if isinstance(client, str):
1642
1642
  client = P115Client(client, check_for_relogin=True)
1643
1643
  if id_to_dirnode is None:
1644
1644
  id_to_dirnode = ID_TO_DIRNODE_CACHE[client.user_id]
@@ -1982,7 +1982,7 @@ def iterdir(
1982
1982
 
1983
1983
  :return: 迭代器,返回此目录内的文件信息(文件和目录)
1984
1984
  """
1985
- if not isinstance(client, P115Client):
1985
+ if isinstance(client, str):
1986
1986
  client = P115Client(client, check_for_relogin=True)
1987
1987
  if isinstance(escape, bool):
1988
1988
  if escape:
@@ -2091,7 +2091,7 @@ def iterdir_limited(
2091
2091
 
2092
2092
  :return: 迭代器,返回此目录内的文件信息(文件和目录)
2093
2093
  """
2094
- if not isinstance(client, P115Client):
2094
+ if isinstance(client, str):
2095
2095
  client = P115Client(client, check_for_relogin=True)
2096
2096
  if isinstance(escape, bool):
2097
2097
  if escape:
@@ -2466,7 +2466,7 @@ def iter_files(
2466
2466
 
2467
2467
  :return: 迭代器,返回此目录内的(仅文件)文件信息
2468
2468
  """
2469
- if not isinstance(client, P115Client):
2469
+ if isinstance(client, str):
2470
2470
  client = P115Client(client, check_for_relogin=True)
2471
2471
  if isinstance(escape, bool):
2472
2472
  if escape:
@@ -2697,7 +2697,7 @@ def traverse_files(
2697
2697
  raise ValueError("please set the non-zero value of suffix or type")
2698
2698
  if suffix:
2699
2699
  suffix = "." + suffix.lower()
2700
- if not isinstance(client, P115Client):
2700
+ if isinstance(client, str):
2701
2701
  client = P115Client(client, check_for_relogin=True)
2702
2702
  if id_to_dirnode is None:
2703
2703
  id_to_dirnode = ID_TO_DIRNODE_CACHE[client.user_id]
@@ -3007,7 +3007,7 @@ def iter_image_files(
3007
3007
  attr["id"] = attr["file_id"]
3008
3008
  attr["name"] = attr["file_name"]
3009
3009
  return attr
3010
- if not isinstance(client, P115Client):
3010
+ if isinstance(client, str):
3011
3011
  client = P115Client(client, check_for_relogin=True)
3012
3012
  if page_size <= 0:
3013
3013
  page_size = 8192
@@ -3124,7 +3124,7 @@ def share_iterdir(
3124
3124
 
3125
3125
  :return: 迭代器,被打上星标的目录信息
3126
3126
  """
3127
- if not isinstance(client, P115Client):
3127
+ if isinstance(client, str):
3128
3128
  client = P115Client(client, check_for_relogin=True)
3129
3129
  if page_size < 0:
3130
3130
  page_size = 10_000
@@ -3221,7 +3221,7 @@ def share_iter_files(
3221
3221
  }
3222
3222
 
3223
3223
  """
3224
- if not isinstance(client, P115Client):
3224
+ if isinstance(client, str):
3225
3225
  client = P115Client(client, check_for_relogin=True)
3226
3226
  def gen_step():
3227
3227
  payload: dict = cast(dict, share_extract_payload(share_link))
@@ -3310,7 +3310,7 @@ def iter_selected_nodes(
3310
3310
 
3311
3311
  :return: 迭代器,产生详细的信息
3312
3312
  """
3313
- if not isinstance(client, P115Client):
3313
+ if isinstance(client, str):
3314
3314
  client = P115Client(client, check_for_relogin=True)
3315
3315
  if id_to_dirnode is None:
3316
3316
  id_to_dirnode = ID_TO_DIRNODE_CACHE[client.user_id]
@@ -3407,7 +3407,7 @@ def iter_selected_nodes_by_pickcode(
3407
3407
 
3408
3408
  :return: 迭代器,产生详细的信息
3409
3409
  """
3410
- if not isinstance(client, P115Client):
3410
+ if isinstance(client, str):
3411
3411
  client = P115Client(client, check_for_relogin=True)
3412
3412
  if id_to_dirnode is None:
3413
3413
  id_to_dirnode = ID_TO_DIRNODE_CACHE[client.user_id]
@@ -3514,7 +3514,7 @@ def iter_selected_nodes_using_edit(
3514
3514
 
3515
3515
  :return: 迭代器,产生详细的信息
3516
3516
  """
3517
- if not isinstance(client, P115Client):
3517
+ if isinstance(client, str):
3518
3518
  client = P115Client(client, check_for_relogin=True)
3519
3519
  if id_to_dirnode is None:
3520
3520
  id_to_dirnode = ID_TO_DIRNODE_CACHE[client.user_id]
@@ -3601,7 +3601,7 @@ def iter_selected_nodes_using_category_get(
3601
3601
 
3602
3602
  :return: 迭代器,产生详细的信息
3603
3603
  """
3604
- if not isinstance(client, P115Client):
3604
+ if isinstance(client, str):
3605
3605
  client = P115Client(client, check_for_relogin=True)
3606
3606
  if id_to_dirnode is None:
3607
3607
  id_to_dirnode = ID_TO_DIRNODE_CACHE[client.user_id]
@@ -3715,7 +3715,7 @@ def iter_selected_nodes_using_star_event(
3715
3715
  "type": int,
3716
3716
  }
3717
3717
  """
3718
- if not isinstance(client, P115Client):
3718
+ if isinstance(client, str):
3719
3719
  client = P115Client(client, check_for_relogin=True)
3720
3720
  if id_to_dirnode is None:
3721
3721
  id_to_dirnode = ID_TO_DIRNODE_CACHE[client.user_id]
@@ -3856,7 +3856,7 @@ def iter_selected_dirs_using_star(
3856
3856
 
3857
3857
  :return: 迭代器,产生详细的信息
3858
3858
  """
3859
- if not isinstance(client, P115Client):
3859
+ if isinstance(client, str):
3860
3860
  client = P115Client(client, check_for_relogin=True)
3861
3861
  def gen_step():
3862
3862
  nonlocal ids
@@ -4006,7 +4006,7 @@ def iter_files_with_dirname(
4006
4006
  payload["suffix"] = suffix
4007
4007
  elif type != 99:
4008
4008
  payload["type"] = type
4009
- if not isinstance(client, P115Client):
4009
+ if isinstance(client, str):
4010
4010
  client = P115Client(client, check_for_relogin=True)
4011
4011
  request_kwargs.update(
4012
4012
  page_size=page_size,
@@ -4209,7 +4209,7 @@ def iter_files_with_path(
4209
4209
  suffix = suffix.strip(".")
4210
4210
  if not (type or suffix):
4211
4211
  raise ValueError("please set the non-zero value of suffix or type")
4212
- if not isinstance(client, P115Client):
4212
+ if isinstance(client, str):
4213
4213
  client = P115Client(client, check_for_relogin=True)
4214
4214
  if isinstance(escape, bool):
4215
4215
  if escape:
@@ -4408,7 +4408,7 @@ def iter_files_with_path_by_export_dir(
4408
4408
  :return: 迭代器,返回此目录内的(仅文件)文件信息
4409
4409
  """
4410
4410
  from .export_dir import export_dir, export_dir_parse_iter, parse_export_dir_as_patht_iter
4411
- if not isinstance(client, P115Client):
4411
+ if isinstance(client, str):
4412
4412
  client = P115Client(client, check_for_relogin=True)
4413
4413
  if isinstance(escape, bool):
4414
4414
  if escape:
@@ -4647,7 +4647,7 @@ def iter_parents_3_level(
4647
4647
 
4648
4648
  :return: 迭代器,产生 id 和 最近 3 级目录名的元组的 2 元组
4649
4649
  """
4650
- if not isinstance(client, P115Client):
4650
+ if isinstance(client, str):
4651
4651
  client = P115Client(client, check_for_relogin=True)
4652
4652
  def fix_overflow(t: tuple[str, ...], /) -> tuple[str, ...]:
4653
4653
  try:
@@ -4747,7 +4747,7 @@ def iter_dir_nodes(
4747
4747
 
4748
4748
  :return: 迭代器,返回此目录内的(仅目录)文件信息
4749
4749
  """
4750
- if not isinstance(client, P115Client):
4750
+ if isinstance(client, str):
4751
4751
  client = P115Client(client, check_for_relogin=True)
4752
4752
  if id_to_dirnode is None:
4753
4753
  id_to_dirnode = ID_TO_DIRNODE_CACHE[client.user_id]
p115client/tool/life.py CHANGED
@@ -73,7 +73,7 @@ def life_show(
73
73
 
74
74
  :return: 接口返回值
75
75
  """
76
- if not isinstance(client, P115Client):
76
+ if isinstance(client, str):
77
77
  client = P115Client(client, check_for_relogin=True)
78
78
  return client.life_calendar_setoption(async_=async_, **request_kwargs)
79
79
 
@@ -121,7 +121,7 @@ def iter_life_list(
121
121
 
122
122
  :return: 迭代器,产生 115 生活操作事件日志数据字典
123
123
  """
124
- if not isinstance(client, P115Client):
124
+ if isinstance(client, str):
125
125
  client = P115Client(client, check_for_relogin=True)
126
126
  life_list = partial(client.life_list, app=app, **request_kwargs)
127
127
  life_behavior_detail = partial(client.life_behavior_detail_app, **request_kwargs)
@@ -238,7 +238,7 @@ def iter_life_behavior_once(
238
238
 
239
239
  :return: 迭代器,产生 115 生活操作事件日志数据字典
240
240
  """
241
- if not isinstance(client, P115Client):
241
+ if isinstance(client, str):
242
242
  client = P115Client(client, check_for_relogin=True)
243
243
  if app in ("", "web", "desktop", "harmony"):
244
244
  life_behavior_detail = partial(client.life_behavior_detail, **request_kwargs)
@@ -342,7 +342,7 @@ def iter_life_behavior(
342
342
 
343
343
  :return: 迭代器,产生 115 生活操作事件日志数据字典
344
344
  """
345
- if not isinstance(client, P115Client):
345
+ if isinstance(client, str):
346
346
  client = P115Client(client, check_for_relogin=True)
347
347
  def gen_step():
348
348
  nonlocal from_time, from_id
@@ -442,7 +442,7 @@ def iter_life_behavior_list(
442
442
 
443
443
  :return: 迭代器,产生 115 生活操作事件日志数据字典
444
444
  """
445
- if not isinstance(client, P115Client):
445
+ if isinstance(client, str):
446
446
  client = P115Client(client, check_for_relogin=True)
447
447
  def gen_step():
448
448
  nonlocal from_time, from_id
p115client/tool/pool.py CHANGED
@@ -61,7 +61,7 @@ def generate_cookies_factory(
61
61
 
62
62
  :return: 函数,调用以返回一个 cookies
63
63
  """
64
- if not isinstance(client, P115Client):
64
+ if isinstance(client, str):
65
65
  client = P115Client(client, check_for_relogin=True)
66
66
  if app:
67
67
  if APP_TO_SSOENT.get(app) == client.login_ssoent:
@@ -96,7 +96,7 @@ def generate_client_factory(
96
96
 
97
97
  :return: 函数,调用以返回一个 client
98
98
  """
99
- if not isinstance(client, P115Client):
99
+ if isinstance(client, str):
100
100
  client = P115Client(client, check_for_relogin=True)
101
101
  if app:
102
102
  if APP_TO_SSOENT.get(app) == client.login_ssoent:
p115client/tool/xys.py CHANGED
@@ -22,7 +22,7 @@ def wish_make(
22
22
 
23
23
  :return: 许愿 id
24
24
  """
25
- if not isinstance(client, P115Client):
25
+ if isinstance(client, str):
26
26
  client = P115Client(client)
27
27
  return check_response(client.act_xys_wish(
28
28
  {"rewardSpace": size, "content": content}
@@ -44,7 +44,7 @@ def wish_answer(
44
44
 
45
45
  :return: 助愿 id
46
46
  """
47
- if not isinstance(client, P115Client):
47
+ if isinstance(client, str):
48
48
  client = P115Client(client)
49
49
  if not isinstance(file_ids, (int, str)):
50
50
  file_ids = ",".join(map(str, file_ids))
@@ -68,7 +68,7 @@ def wish_list(
68
68
 
69
69
  :return: 许愿列表
70
70
  """
71
- if not isinstance(client, P115Client):
71
+ if isinstance(client, str):
72
72
  client = P115Client(client)
73
73
  payload: dict = {"type": type, "limit": 1000, "page": 1}
74
74
  ls = adds = check_response(client.act_xys_my_desire(payload))["data"]["list"]
@@ -90,7 +90,7 @@ def wish_aid_list(
90
90
 
91
91
  :return: 助愿列表
92
92
  """
93
- if not isinstance(client, P115Client):
93
+ if isinstance(client, str):
94
94
  client = P115Client(client)
95
95
  payload: dict = {"id": wish_id, "limit": 1000, "page": 1}
96
96
  ls = adds = check_response(client.act_xys_desire_aid_list(payload))["data"]["list"]
@@ -116,7 +116,7 @@ def wish_adopt(
116
116
 
117
117
  :return: 返回信息
118
118
  """
119
- if not isinstance(client, P115Client):
119
+ if isinstance(client, str):
120
120
  client = P115Client(client)
121
121
  return check_response(client.act_xys_adopt({"did": wish_id, "aid": aid_id, "to_cid": to_cid}))
122
122
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: p115client
3
- Version: 0.0.5.6.9
3
+ Version: 0.0.5.8
4
4
  Summary: Python 115 webdisk client.
5
5
  Home-page: https://github.com/ChenyangGao/p115client
6
6
  License: MIT
@@ -24,22 +24,22 @@ Requires-Dist: aiofile
24
24
  Requires-Dist: ed2k (>=0.0.2.1)
25
25
  Requires-Dist: http_response (>=0.0.2.2)
26
26
  Requires-Dist: httpx
27
- Requires-Dist: httpx_request (>=0.1.2)
27
+ Requires-Dist: httpx_request (>=0.1.3)
28
28
  Requires-Dist: iter_collect (>=0.0.5.1)
29
29
  Requires-Dist: multidict
30
30
  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.1)
34
+ Requires-Dist: python-asynctools (>=0.1.2)
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.7.1)
39
+ Requires-Dist: python-filewrap (>=0.2.8)
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.1)
42
+ Requires-Dist: python-httpfile (>=0.0.5.2)
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)
@@ -0,0 +1,23 @@
1
+ LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
2
+ p115client/__init__.py,sha256=1mx7njuAlqcuEWONTjSiiGnXyyNyqOcJyNX1FMHqQ-4,214
3
+ p115client/_upload.py,sha256=j2XHz6-hc9qyfiF92aZY-LPJ3UgbB6e4Jy6CNGQ5rwk,29904
4
+ p115client/client.py,sha256=Vx3oiy_TsAjmxXgER25YFsosXaAaEwCGwIhfMziK-J0,707691
5
+ p115client/const.py,sha256=maIZfJAiUuEnXIKc8TMAyW_UboDUJPwYpPS8LjPFp_U,4321
6
+ p115client/exception.py,sha256=Ugjr__aSlYRDYwoOz7273ngV-gFX2z-ohsJmCba8nnQ,2657
7
+ p115client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ p115client/tool/__init__.py,sha256=2YrKoAcFYOuqu2nUBoPVhxMOseAvcLE_LcnbZV11UKw,324
9
+ p115client/tool/download.py,sha256=pol98aojEWtD2WOKCgAVTqpRLxo9yjjwNwo8qR5nfF8,56133
10
+ p115client/tool/edit.py,sha256=VtJq3IU1iSLxzlzrdUcjkPlaDXW3c2s5x2pSym78tG8,16406
11
+ p115client/tool/export_dir.py,sha256=iMnKtnESi8HKvW9WhIvOdEoMXSBpAnhFlGeyKXHpQbE,24545
12
+ p115client/tool/fs_files.py,sha256=hkezLKrtTAGPDkPxwq6jMrm8s2-unHZQBR7cDvh41qs,16027
13
+ p115client/tool/iterdir.py,sha256=U7N_clidyoFfhRK5f8R_9MRjP5BEK7xBqezCw7bxOeQ,184109
14
+ p115client/tool/life.py,sha256=SJ1dAvRYCWTUz1gPrCWv-_G1Rq5yPfxDgY7KT-2UP4A,17528
15
+ p115client/tool/pool.py,sha256=vM5ItMxELtT7_bvbmdhwWj81rQ0zyaj3uPMny4KDw_E,9757
16
+ p115client/tool/request.py,sha256=SWsezW9EYZGS3R-TbZxMG-8bN3YWJ0-GzgvKlvRBSCM,7042
17
+ p115client/tool/upload.py,sha256=qK1OQYxP-Faq2eMDhc5sBXJiSr8m8EZ_gb0O_iA2TrI,15915
18
+ p115client/tool/xys.py,sha256=n89n9OLBXx6t20L61wJgfrP6V4jW3sHgyaQNBLdUwUQ,3578
19
+ p115client/type.py,sha256=e4g9URQBE23XN2dGomldj8wC6NlDWBBSVC5Bmd8giBc,5993
20
+ p115client-0.0.5.8.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
21
+ p115client-0.0.5.8.dist-info/METADATA,sha256=e9KtIc-4iaRg7s-4SQQ2I4CtssL3frgQVeNMvBbcMJI,8230
22
+ p115client-0.0.5.8.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
23
+ p115client-0.0.5.8.dist-info/RECORD,,
@@ -1,23 +0,0 @@
1
- LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
2
- p115client/__init__.py,sha256=1mx7njuAlqcuEWONTjSiiGnXyyNyqOcJyNX1FMHqQ-4,214
3
- p115client/_upload.py,sha256=j2XHz6-hc9qyfiF92aZY-LPJ3UgbB6e4Jy6CNGQ5rwk,29904
4
- p115client/client.py,sha256=h5ErTOe3EMPGaPZwXQUT6s9zRDZmpNZ7dNlcX_MvfdU,697951
5
- p115client/const.py,sha256=maIZfJAiUuEnXIKc8TMAyW_UboDUJPwYpPS8LjPFp_U,4321
6
- p115client/exception.py,sha256=Ugjr__aSlYRDYwoOz7273ngV-gFX2z-ohsJmCba8nnQ,2657
7
- p115client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- p115client/tool/__init__.py,sha256=2YrKoAcFYOuqu2nUBoPVhxMOseAvcLE_LcnbZV11UKw,324
9
- p115client/tool/download.py,sha256=KY-8QHhCm_Mk-ygtuQXuPtoIIJHRWg5XNQQx0WDncGA,56232
10
- p115client/tool/edit.py,sha256=NQiyVoOKKed6VbUj_AamGmTWXfcioOFqq5buFUWOh_8,16428
11
- p115client/tool/export_dir.py,sha256=hGjM49QSb7zQSZ5KGJ4Ka7T8oIh8T5at0yXr1nmmcdA,24114
12
- p115client/tool/fs_files.py,sha256=hkezLKrtTAGPDkPxwq6jMrm8s2-unHZQBR7cDvh41qs,16027
13
- p115client/tool/iterdir.py,sha256=jS9usgdF4fsmaxLUzq0bx17Cez1c7hUIDfD-nKXf0-E,184428
14
- p115client/tool/life.py,sha256=8STXfjL8DPp0YTLFsE7Dt_6c2wj_0AvScq6WrjX9i9M,17583
15
- p115client/tool/pool.py,sha256=vFV3t4g8KuQ4Rlttd1bs7d0Lc8jFUufdmDQweMcLZZw,9779
16
- p115client/tool/request.py,sha256=SWsezW9EYZGS3R-TbZxMG-8bN3YWJ0-GzgvKlvRBSCM,7042
17
- p115client/tool/upload.py,sha256=qK1OQYxP-Faq2eMDhc5sBXJiSr8m8EZ_gb0O_iA2TrI,15915
18
- p115client/tool/xys.py,sha256=6NZUkWNsWW6dHDBUpMitmE-1YlkobWIUQ86CBjKJ4mQ,3633
19
- p115client/type.py,sha256=e4g9URQBE23XN2dGomldj8wC6NlDWBBSVC5Bmd8giBc,5993
20
- p115client-0.0.5.6.9.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
21
- p115client-0.0.5.6.9.dist-info/METADATA,sha256=-7_g9u0udHNL4oneoOF2hIlRfFg8fl1afpL-DqQJOdM,8232
22
- p115client-0.0.5.6.9.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
23
- p115client-0.0.5.6.9.dist-info/RECORD,,