p115client 0.0.5.8.6__py3-none-any.whl → 0.0.5.8.7__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 +34 -14
- {p115client-0.0.5.8.6.dist-info → p115client-0.0.5.8.7.dist-info}/METADATA +1 -1
- {p115client-0.0.5.8.6.dist-info → p115client-0.0.5.8.7.dist-info}/RECORD +5 -5
- {p115client-0.0.5.8.6.dist-info → p115client-0.0.5.8.7.dist-info}/LICENSE +0 -0
- {p115client-0.0.5.8.6.dist-info → p115client-0.0.5.8.7.dist-info}/WHEEL +0 -0
p115client/client.py
CHANGED
@@ -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["
|
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,7 +1,7 @@
|
|
1
1
|
LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
|
2
2
|
p115client/__init__.py,sha256=1mx7njuAlqcuEWONTjSiiGnXyyNyqOcJyNX1FMHqQ-4,214
|
3
3
|
p115client/_upload.py,sha256=DOckFLU_P7Fl0BNu_0-2od6pPsCnzroYY6zZE5_EMnM,30735
|
4
|
-
p115client/client.py,sha256=
|
4
|
+
p115client/client.py,sha256=GhLFoGzmZunVqMajS6xZZqs5k-I_2sR9LQlP102MFjE,718070
|
5
5
|
p115client/const.py,sha256=maIZfJAiUuEnXIKc8TMAyW_UboDUJPwYpPS8LjPFp_U,4321
|
6
6
|
p115client/exception.py,sha256=Ugjr__aSlYRDYwoOz7273ngV-gFX2z-ohsJmCba8nnQ,2657
|
7
7
|
p115client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -17,7 +17,7 @@ p115client/tool/request.py,sha256=SWsezW9EYZGS3R-TbZxMG-8bN3YWJ0-GzgvKlvRBSCM,70
|
|
17
17
|
p115client/tool/upload.py,sha256=qK1OQYxP-Faq2eMDhc5sBXJiSr8m8EZ_gb0O_iA2TrI,15915
|
18
18
|
p115client/tool/xys.py,sha256=n89n9OLBXx6t20L61wJgfrP6V4jW3sHgyaQNBLdUwUQ,3578
|
19
19
|
p115client/type.py,sha256=e4g9URQBE23XN2dGomldj8wC6NlDWBBSVC5Bmd8giBc,5993
|
20
|
-
p115client-0.0.5.8.
|
21
|
-
p115client-0.0.5.8.
|
22
|
-
p115client-0.0.5.8.
|
23
|
-
p115client-0.0.5.8.
|
20
|
+
p115client-0.0.5.8.7.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
|
21
|
+
p115client-0.0.5.8.7.dist-info/METADATA,sha256=v74Y9_1ZIk2j2CvMT-9q4RIUDH1FqsRnYCSbqt2ZifU,8233
|
22
|
+
p115client-0.0.5.8.7.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
23
|
+
p115client-0.0.5.8.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|