p115client 0.0.5.6.9__tar.gz → 0.0.5.7__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.
Files changed (22) hide show
  1. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/PKG-INFO +4 -4
  2. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/p115client/tool/download.py +9 -9
  3. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/p115client/tool/edit.py +2 -2
  4. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/p115client/tool/export_dir.py +31 -26
  5. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/p115client/tool/iterdir.py +29 -29
  6. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/p115client/tool/life.py +5 -5
  7. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/p115client/tool/pool.py +2 -2
  8. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/p115client/tool/xys.py +5 -5
  9. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/pyproject.toml +4 -4
  10. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/LICENSE +0 -0
  11. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/p115client/__init__.py +0 -0
  12. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/p115client/_upload.py +0 -0
  13. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/p115client/client.py +0 -0
  14. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/p115client/const.py +0 -0
  15. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/p115client/exception.py +0 -0
  16. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/p115client/py.typed +0 -0
  17. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/p115client/tool/__init__.py +0 -0
  18. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/p115client/tool/fs_files.py +0 -0
  19. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/p115client/tool/request.py +0 -0
  20. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/p115client/tool/upload.py +0 -0
  21. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/p115client/type.py +0 -0
  22. {p115client-0.0.5.6.9 → p115client-0.0.5.7}/readme.md +0 -0
@@ -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.7
4
4
  Summary: Python 115 webdisk client.
5
5
  Home-page: https://github.com/ChenyangGao/p115client
6
6
  License: MIT
@@ -24,7 +24,7 @@ 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
@@ -36,10 +36,10 @@ 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)
@@ -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]
@@ -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]
@@ -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
@@ -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:
@@ -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
  [tool.poetry]
2
2
  name = "p115client"
3
- version = "0.0.5.6.9"
3
+ version = "0.0.5.7"
4
4
  description = "Python 115 webdisk client."
5
5
  authors = ["ChenyangGao <wosiwujm@gmail.com>"]
6
6
  license = "MIT"
@@ -32,7 +32,7 @@ aiofile = "*"
32
32
  ed2k = ">=0.0.2.1"
33
33
  http_response = ">=0.0.2.2"
34
34
  httpx = "*"
35
- httpx_request = ">=0.1.2"
35
+ httpx_request = ">=0.1.3"
36
36
  iter_collect = ">=0.0.5.1"
37
37
  multidict = "*"
38
38
  orjson = "*"
@@ -44,9 +44,9 @@ 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.7.1"
47
+ python-filewrap = ">=0.2.8"
48
48
  python-hashtools = ">=0.0.3.3"
49
- python-httpfile = ">=0.0.5.1"
49
+ python-httpfile = ">=0.0.5.2"
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