p115client 0.0.5.8.6__tar.gz → 0.0.5.8.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.8.6 → p115client-0.0.5.8.7}/PKG-INFO +1 -1
  2. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/p115client/client.py +34 -14
  3. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/pyproject.toml +1 -1
  4. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/LICENSE +0 -0
  5. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/p115client/__init__.py +0 -0
  6. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/p115client/_upload.py +0 -0
  7. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/p115client/const.py +0 -0
  8. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/p115client/exception.py +0 -0
  9. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/p115client/py.typed +0 -0
  10. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/p115client/tool/__init__.py +0 -0
  11. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/p115client/tool/download.py +0 -0
  12. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/p115client/tool/edit.py +0 -0
  13. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/p115client/tool/export_dir.py +0 -0
  14. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/p115client/tool/fs_files.py +0 -0
  15. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/p115client/tool/iterdir.py +0 -0
  16. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/p115client/tool/life.py +0 -0
  17. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/p115client/tool/pool.py +0 -0
  18. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/p115client/tool/request.py +0 -0
  19. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/p115client/tool/upload.py +0 -0
  20. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/p115client/tool/xys.py +0 -0
  21. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/p115client/type.py +0 -0
  22. {p115client-0.0.5.8.6 → p115client-0.0.5.8.7}/readme.md +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: p115client
3
- Version: 0.0.5.8.6
3
+ Version: 0.0.5.8.7
4
4
  Summary: Python 115 webdisk client.
5
5
  Home-page: https://github.com/ChenyangGao/p115client
6
6
  License: MIT
@@ -1022,6 +1022,12 @@ class ClientRequestMixin:
1022
1022
  for cookie in cookies:
1023
1023
  set_cookie(create_cookie("", cookie))
1024
1024
 
1025
+ @cookies.deleter
1026
+ def cookies(self, /):
1027
+ """请求所用的 Cookies 对象(同步和异步共用)
1028
+ """
1029
+ self.cookies = None
1030
+
1025
1031
  @property
1026
1032
  def cookiejar(self, /) -> CookieJar:
1027
1033
  """请求所用的 CookieJar 对象(同步和异步共用)
@@ -1765,7 +1771,7 @@ class ClientRequestMixin:
1765
1771
  def login_with_open(
1766
1772
  cls,
1767
1773
  /,
1768
- app_id: int | str,
1774
+ app_id: int | str = 100195993,
1769
1775
  console_qrcode: bool = True,
1770
1776
  *,
1771
1777
  async_: Literal[False] = False,
@@ -1777,7 +1783,7 @@ class ClientRequestMixin:
1777
1783
  def login_with_open(
1778
1784
  cls,
1779
1785
  /,
1780
- app_id: int | str,
1786
+ app_id: int | str = 100195993,
1781
1787
  console_qrcode: bool = True,
1782
1788
  *,
1783
1789
  async_: Literal[True],
@@ -1788,7 +1794,7 @@ class ClientRequestMixin:
1788
1794
  def login_with_open(
1789
1795
  cls,
1790
1796
  /,
1791
- app_id: int | str,
1797
+ app_id: int | str = 100195993,
1792
1798
  console_qrcode: bool = True,
1793
1799
  *,
1794
1800
  async_: Literal[False, True] = False,
@@ -2458,7 +2464,7 @@ class P115OpenClient(ClientRequestMixin):
2458
2464
 
2459
2465
  @access_token.setter
2460
2466
  def access_token(self, token, /):
2461
- self.headers["Authorization"] = "Bearer " + token
2467
+ self.headers["authorization"] = "Bearer " + token
2462
2468
  self.__dict__["access_token"] = token
2463
2469
 
2464
2470
  @property
@@ -2470,6 +2476,11 @@ class P115OpenClient(ClientRequestMixin):
2470
2476
  token = self.__dict__["upload_token"] = resp["data"]
2471
2477
  return token
2472
2478
 
2479
+ @locked_cacheproperty
2480
+ def user_id(self, /) -> int:
2481
+ resp = check_response(self.user_info_open())
2482
+ return int(resp["data"]["user_id"])
2483
+
2473
2484
  @overload
2474
2485
  def refresh_access_token(
2475
2486
  self,
@@ -4220,11 +4231,20 @@ class P115Client(P115OpenClient):
4220
4231
  if not cookies_equal(cookies_old, cookies_new):
4221
4232
  self._write_cookies(cookies_new)
4222
4233
 
4234
+ @cookies.deleter
4235
+ def cookies(self, /):
4236
+ """请求所用的 Cookies 对象(同步和异步共用)
4237
+ """
4238
+ self.cookies = None
4239
+
4223
4240
  @locked_cacheproperty
4224
4241
  def user_id(self, /) -> int:
4225
4242
  cookie_uid = self.cookies.get("UID")
4226
4243
  if cookie_uid:
4227
4244
  return int(cookie_uid.split("_")[0])
4245
+ elif "authorization" in self.headers:
4246
+ resp = check_response(self.user_info_open())
4247
+ return int(resp["data"]["user_id"])
4228
4248
  else:
4229
4249
  return 0
4230
4250
 
@@ -4914,9 +4934,9 @@ class P115Client(P115OpenClient):
4914
4934
  def login_another_open(
4915
4935
  self,
4916
4936
  /,
4917
- app_id: int | str,
4918
- replace: Literal[True] | Self,
4937
+ app_id: int | str = 100195993,
4919
4938
  *,
4939
+ replace: Literal[True] | Self,
4920
4940
  async_: Literal[False] = False,
4921
4941
  **request_kwargs,
4922
4942
  ) -> Self:
@@ -4925,9 +4945,9 @@ class P115Client(P115OpenClient):
4925
4945
  def login_another_open(
4926
4946
  self,
4927
4947
  /,
4928
- app_id: int | str,
4929
- replace: Literal[True] | Self,
4948
+ app_id: int | str = 100195993,
4930
4949
  *,
4950
+ replace: Literal[True] | Self,
4931
4951
  async_: Literal[True],
4932
4952
  **request_kwargs,
4933
4953
  ) -> Coroutine[Any, Any, Self]:
@@ -4936,9 +4956,9 @@ class P115Client(P115OpenClient):
4936
4956
  def login_another_open(
4937
4957
  self,
4938
4958
  /,
4939
- app_id: int | str,
4940
- replace: Literal[False] = False,
4959
+ app_id: int | str = 100195993,
4941
4960
  *,
4961
+ replace: Literal[False] = False,
4942
4962
  async_: Literal[False] = False,
4943
4963
  **request_kwargs,
4944
4964
  ) -> P115OpenClient:
@@ -4947,9 +4967,9 @@ class P115Client(P115OpenClient):
4947
4967
  def login_another_open(
4948
4968
  self,
4949
4969
  /,
4950
- app_id: int | str,
4951
- replace: Literal[False] = False,
4970
+ app_id: int | str = 100195993,
4952
4971
  *,
4972
+ replace: Literal[False] = False,
4953
4973
  async_: Literal[True],
4954
4974
  **request_kwargs,
4955
4975
  ) -> Coroutine[Any, Any, P115OpenClient]:
@@ -4957,9 +4977,9 @@ class P115Client(P115OpenClient):
4957
4977
  def login_another_open(
4958
4978
  self,
4959
4979
  /,
4960
- app_id: int | str,
4961
- replace: bool | Self = False,
4980
+ app_id: int | str = 100195993,
4962
4981
  *,
4982
+ replace: bool | Self = False,
4963
4983
  async_: Literal[False, True] = False,
4964
4984
  **request_kwargs,
4965
4985
  ) -> P115OpenClient | Coroutine[Any, Any, P115OpenClient] | Self | Coroutine[Any, Any, Self]:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "p115client"
3
- version = "0.0.5.8.6"
3
+ version = "0.0.5.8.7"
4
4
  description = "Python 115 webdisk client."
5
5
  authors = ["ChenyangGao <wosiwujm@gmail.com>"]
6
6
  license = "MIT"
File without changes
File without changes