p115client 0.0.5.11.6__py3-none-any.whl → 0.0.5.11.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 +72 -17
- p115client/const.py +2 -6
- p115client/tool/attr.py +2 -2
- p115client/tool/pool.py +2 -3
- {p115client-0.0.5.11.6.dist-info → p115client-0.0.5.11.7.dist-info}/METADATA +2 -2
- {p115client-0.0.5.11.6.dist-info → p115client-0.0.5.11.7.dist-info}/RECORD +8 -8
- {p115client-0.0.5.11.6.dist-info → p115client-0.0.5.11.7.dist-info}/LICENSE +0 -0
- {p115client-0.0.5.11.6.dist-info → p115client-0.0.5.11.7.dist-info}/WHEEL +0 -0
p115client/client.py
CHANGED
@@ -766,7 +766,7 @@ def normalize_attr_app[D: dict[str, Any]](
|
|
766
766
|
simple: bool = False,
|
767
767
|
keep_raw: bool = False,
|
768
768
|
*,
|
769
|
-
dict_cls:
|
769
|
+
dict_cls: type[D],
|
770
770
|
) -> D:
|
771
771
|
...
|
772
772
|
def normalize_attr_app[D: dict[str, Any]](
|
@@ -896,7 +896,7 @@ def normalize_attr_app2[D: dict[str, Any]](
|
|
896
896
|
simple: bool = False,
|
897
897
|
keep_raw: bool = False,
|
898
898
|
*,
|
899
|
-
dict_cls:
|
899
|
+
dict_cls: type[D],
|
900
900
|
) -> D:
|
901
901
|
...
|
902
902
|
def normalize_attr_app2[D: dict[str, Any]](
|
@@ -1082,7 +1082,7 @@ def normalize_attr_simple(
|
|
1082
1082
|
/,
|
1083
1083
|
keep_raw: bool = False,
|
1084
1084
|
*,
|
1085
|
-
dict_cls: None
|
1085
|
+
dict_cls: None,
|
1086
1086
|
) -> dict[str, Any]:
|
1087
1087
|
...
|
1088
1088
|
@overload
|
@@ -1091,7 +1091,7 @@ def normalize_attr_simple[D: dict[str, Any]](
|
|
1091
1091
|
/,
|
1092
1092
|
keep_raw: bool = False,
|
1093
1093
|
*,
|
1094
|
-
dict_cls: type[D],
|
1094
|
+
dict_cls: type[D] = AttrDict, # type: ignore
|
1095
1095
|
) -> D:
|
1096
1096
|
...
|
1097
1097
|
def normalize_attr_simple[D: dict[str, Any]](
|
@@ -1099,7 +1099,7 @@ def normalize_attr_simple[D: dict[str, Any]](
|
|
1099
1099
|
/,
|
1100
1100
|
keep_raw: bool = False,
|
1101
1101
|
*,
|
1102
|
-
dict_cls: None | type[D] =
|
1102
|
+
dict_cls: None | type[D] = AttrDict, # type: ignore
|
1103
1103
|
) -> dict[str, Any] | D:
|
1104
1104
|
return normalize_attr(
|
1105
1105
|
info,
|
@@ -2329,7 +2329,7 @@ class ClientRequestMixin:
|
|
2329
2329
|
def login_with_app_id(
|
2330
2330
|
cls,
|
2331
2331
|
/,
|
2332
|
-
app_id: int | str
|
2332
|
+
app_id: int | str,
|
2333
2333
|
console_qrcode: bool = True,
|
2334
2334
|
base_url: str | Callable[[], str] = "https://qrcodeapi.115.com",
|
2335
2335
|
*,
|
@@ -2342,7 +2342,7 @@ class ClientRequestMixin:
|
|
2342
2342
|
def login_with_app_id(
|
2343
2343
|
cls,
|
2344
2344
|
/,
|
2345
|
-
app_id: int | str
|
2345
|
+
app_id: int | str,
|
2346
2346
|
console_qrcode: bool = True,
|
2347
2347
|
base_url: str | Callable[[], str] = "https://qrcodeapi.115.com",
|
2348
2348
|
*,
|
@@ -2354,7 +2354,7 @@ class ClientRequestMixin:
|
|
2354
2354
|
def login_with_app_id(
|
2355
2355
|
cls,
|
2356
2356
|
/,
|
2357
|
-
app_id: int | str
|
2357
|
+
app_id: int | str,
|
2358
2358
|
console_qrcode: bool = True,
|
2359
2359
|
base_url: str | Callable[[], str] = "https://qrcodeapi.115.com",
|
2360
2360
|
*,
|
@@ -5194,6 +5194,60 @@ class P115OpenClient(ClientRequestMixin):
|
|
5194
5194
|
api = complete_proapi("/open/user/info", base_url)
|
5195
5195
|
return self.request(url=api, async_=async_, **request_kwargs)
|
5196
5196
|
|
5197
|
+
@overload
|
5198
|
+
def vip_qr_url(
|
5199
|
+
self,
|
5200
|
+
payload: int | dict,
|
5201
|
+
/,
|
5202
|
+
base_url: bool | str | Callable[[], str] = False,
|
5203
|
+
*,
|
5204
|
+
async_: Literal[False] = False,
|
5205
|
+
**request_kwargs,
|
5206
|
+
) -> dict:
|
5207
|
+
...
|
5208
|
+
@overload
|
5209
|
+
def vip_qr_url(
|
5210
|
+
self,
|
5211
|
+
payload: int | dict,
|
5212
|
+
/,
|
5213
|
+
base_url: bool | str | Callable[[], str] = False,
|
5214
|
+
*,
|
5215
|
+
async_: Literal[True],
|
5216
|
+
**request_kwargs,
|
5217
|
+
) -> Coroutine[Any, Any, dict]:
|
5218
|
+
...
|
5219
|
+
def vip_qr_url(
|
5220
|
+
self,
|
5221
|
+
payload: int | dict,
|
5222
|
+
/,
|
5223
|
+
base_url: bool | str | Callable[[], str] = False,
|
5224
|
+
*,
|
5225
|
+
async_: Literal[False, True] = False,
|
5226
|
+
**request_kwargs,
|
5227
|
+
) -> dict | Coroutine[Any, Any, dict]:
|
5228
|
+
"""获取产品列表地址(即引导用户扫码购买 115 的 VIP 服务,以获取提成)
|
5229
|
+
|
5230
|
+
GET https://proapi.115.com/open/open/vip/qr_url
|
5231
|
+
|
5232
|
+
.. admonition:: Reference
|
5233
|
+
|
5234
|
+
https://www.yuque.com/115yun/open/cguk6qshgapwg4qn#oByvI
|
5235
|
+
|
5236
|
+
:payload:
|
5237
|
+
- open_device: int
|
5238
|
+
- default_product_id: int = <default> 💡 打开产品列表默认选中的产品对应的产品id,如果没有则使用默认的产品顺序。
|
5239
|
+
|
5240
|
+
- 月费: 5
|
5241
|
+
- 年费: 1
|
5242
|
+
- 尝鲜1天: 101
|
5243
|
+
- 长期VIP(长期): 24072401
|
5244
|
+
- 超级VIP: 24072402
|
5245
|
+
"""
|
5246
|
+
api = complete_proapi("/open/vip/qr_url", base_url)
|
5247
|
+
if not isinstance(payload, dict):
|
5248
|
+
payload = {"open_device": payload}
|
5249
|
+
return self.request(url=api, params=payload, async_=async_, **request_kwargs)
|
5250
|
+
|
5197
5251
|
download_url_open = download_url
|
5198
5252
|
download_url_info_open = download_url_info
|
5199
5253
|
fs_copy_open = fs_copy
|
@@ -5226,6 +5280,7 @@ class P115OpenClient(ClientRequestMixin):
|
|
5226
5280
|
user_info_open = user_info
|
5227
5281
|
upload_file_init_open = upload_file_init
|
5228
5282
|
upload_file_open = upload_file
|
5283
|
+
vip_qr_url_open = vip_qr_url
|
5229
5284
|
|
5230
5285
|
|
5231
5286
|
class P115Client(P115OpenClient):
|
@@ -5902,7 +5957,7 @@ class P115Client(P115OpenClient):
|
|
5902
5957
|
def login_with_open(
|
5903
5958
|
self,
|
5904
5959
|
/,
|
5905
|
-
app_id: int | str
|
5960
|
+
app_id: int | str,
|
5906
5961
|
*,
|
5907
5962
|
show_warning: bool = False,
|
5908
5963
|
async_: Literal[False] = False,
|
@@ -5913,7 +5968,7 @@ class P115Client(P115OpenClient):
|
|
5913
5968
|
def login_with_open(
|
5914
5969
|
self,
|
5915
5970
|
/,
|
5916
|
-
app_id: int | str
|
5971
|
+
app_id: int | str,
|
5917
5972
|
*,
|
5918
5973
|
show_warning: bool = False,
|
5919
5974
|
async_: Literal[True],
|
@@ -5923,7 +5978,7 @@ class P115Client(P115OpenClient):
|
|
5923
5978
|
def login_with_open(
|
5924
5979
|
self,
|
5925
5980
|
/,
|
5926
|
-
app_id: int | str
|
5981
|
+
app_id: int | str,
|
5927
5982
|
*,
|
5928
5983
|
show_warning: bool = False,
|
5929
5984
|
async_: Literal[False, True] = False,
|
@@ -6098,7 +6153,7 @@ class P115Client(P115OpenClient):
|
|
6098
6153
|
def login_another_open(
|
6099
6154
|
self,
|
6100
6155
|
/,
|
6101
|
-
app_id: int | str
|
6156
|
+
app_id: int | str,
|
6102
6157
|
*,
|
6103
6158
|
replace: Literal[True] | Self,
|
6104
6159
|
show_warning: bool = False,
|
@@ -6110,7 +6165,7 @@ class P115Client(P115OpenClient):
|
|
6110
6165
|
def login_another_open(
|
6111
6166
|
self,
|
6112
6167
|
/,
|
6113
|
-
app_id: int | str
|
6168
|
+
app_id: int | str,
|
6114
6169
|
*,
|
6115
6170
|
replace: Literal[True] | Self,
|
6116
6171
|
show_warning: bool = False,
|
@@ -6122,7 +6177,7 @@ class P115Client(P115OpenClient):
|
|
6122
6177
|
def login_another_open(
|
6123
6178
|
self,
|
6124
6179
|
/,
|
6125
|
-
app_id: int | str
|
6180
|
+
app_id: int | str,
|
6126
6181
|
*,
|
6127
6182
|
replace: Literal[False] = False,
|
6128
6183
|
show_warning: bool = False,
|
@@ -6134,7 +6189,7 @@ class P115Client(P115OpenClient):
|
|
6134
6189
|
def login_another_open(
|
6135
6190
|
self,
|
6136
6191
|
/,
|
6137
|
-
app_id: int | str
|
6192
|
+
app_id: int | str,
|
6138
6193
|
*,
|
6139
6194
|
replace: Literal[False] = False,
|
6140
6195
|
show_warning: bool = False,
|
@@ -6145,7 +6200,7 @@ class P115Client(P115OpenClient):
|
|
6145
6200
|
def login_another_open(
|
6146
6201
|
self,
|
6147
6202
|
/,
|
6148
|
-
app_id: int | str
|
6203
|
+
app_id: int | str,
|
6149
6204
|
*,
|
6150
6205
|
replace: bool | Self = False,
|
6151
6206
|
show_warning: bool = False,
|
@@ -6540,7 +6595,7 @@ class P115Client(P115OpenClient):
|
|
6540
6595
|
continue
|
6541
6596
|
if i or is_auth_error:
|
6542
6597
|
raise
|
6543
|
-
app_id = getattr(self, "app_id"
|
6598
|
+
app_id = getattr(self, "app_id")
|
6544
6599
|
yield self.login_another_open(
|
6545
6600
|
app_id,
|
6546
6601
|
replace=True,
|
p115client/const.py
CHANGED
@@ -5,18 +5,14 @@ from __future__ import annotations
|
|
5
5
|
|
6
6
|
__author__ = "ChenyangGao <https://chenyanggao.github.io>"
|
7
7
|
__all__ = [
|
8
|
-
"
|
9
|
-
"
|
8
|
+
"AVAILABLE_APPS", "APP_TO_SSOENT", "SSOENT_TO_APP", "CLIENT_API_MAP",
|
9
|
+
"CLASS_TO_TYPE", "SUFFIX_TO_TYPE", "errno",
|
10
10
|
]
|
11
11
|
|
12
12
|
from enum import IntEnum
|
13
13
|
from typing import Final
|
14
14
|
|
15
15
|
|
16
|
-
#: 可用的 AppID 列表
|
17
|
-
AVAILABLE_APP_IDS = range(100195123, 100196845, 2)
|
18
|
-
|
19
|
-
|
20
16
|
#: 目前可用的登录设备
|
21
17
|
AVAILABLE_APPS: Final[tuple[str, ...]] = (
|
22
18
|
"web", "ios", "115ios", "android", "115android", "115ipad", "tv", "qandroid",
|
p115client/tool/attr.py
CHANGED
@@ -55,8 +55,8 @@ def get_attr(
|
|
55
55
|
if isinstance(client, str):
|
56
56
|
client = P115Client(client, check_for_relogin=True)
|
57
57
|
def gen_step():
|
58
|
+
from dictattr import AttrDict
|
58
59
|
if skim:
|
59
|
-
from dictattr import AttrDict
|
60
60
|
resp = yield client.fs_file_skim(id, async_=async_, **request_kwargs)
|
61
61
|
check_response(resp)
|
62
62
|
info = resp["data"][0]
|
@@ -71,7 +71,7 @@ def get_attr(
|
|
71
71
|
else:
|
72
72
|
resp = yield client.fs_file(id, async_=async_, **request_kwargs)
|
73
73
|
check_response(resp)
|
74
|
-
return normalize_attr_web(resp["data"][0])
|
74
|
+
return normalize_attr_web(resp["data"][0], dict_cls=AttrDict)
|
75
75
|
return run_gen_step(gen_step, may_call=False, async_=async_)
|
76
76
|
|
77
77
|
|
p115client/tool/pool.py
CHANGED
@@ -21,7 +21,6 @@ from time import time
|
|
21
21
|
|
22
22
|
from iterutils import run_gen_step
|
23
23
|
from p115client import check_response, P115Client
|
24
|
-
from p115client.const import AVAILABLE_APP_IDS
|
25
24
|
from p115client.exception import P115OSError, AuthenticationError, LoginError
|
26
25
|
|
27
26
|
from .util import get_status_code, is_timeouterror
|
@@ -55,7 +54,7 @@ class ComparedWithID[T]:
|
|
55
54
|
|
56
55
|
def generate_auth_factory(
|
57
56
|
client: str | P115Client,
|
58
|
-
app_ids: Iterable[int]
|
57
|
+
app_ids: Iterable[int],
|
59
58
|
**request_kwargs,
|
60
59
|
) -> Callable:
|
61
60
|
"""利用一个已登录设备的 cookies,产生若干开放应用的 access_token
|
@@ -238,7 +237,7 @@ def make_pool[T](
|
|
238
237
|
|
239
238
|
def auth_pool(
|
240
239
|
client: str | P115Client,
|
241
|
-
app_ids: Iterable[int]
|
240
|
+
app_ids: Iterable[int],
|
242
241
|
heap: None | list[tuple[float, dict | ComparedWithID[dict]]] = None,
|
243
242
|
cooldown_time: int | float = 1,
|
244
243
|
live_time: int | float = 7000,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: p115client
|
3
|
-
Version: 0.0.5.11.
|
3
|
+
Version: 0.0.5.11.7
|
4
4
|
Summary: Python 115 webdisk client.
|
5
5
|
Home-page: https://github.com/ChenyangGao/p115client
|
6
6
|
License: MIT
|
@@ -108,7 +108,7 @@ client = P115Client(Path("~/115-cookies.txt").expanduser(), check_for_relogin=Tr
|
|
108
108
|
|
109
109
|
如果你有一个申请通过的开放接口的应用,则可以创建开放接口的客户端实例
|
110
110
|
|
111
|
-
你可以直接从一个 `P115Client`
|
111
|
+
你可以直接从一个 `P115Client` 实例拿到授权(自动扫码登录并授权)
|
112
112
|
|
113
113
|
```python
|
114
114
|
app_id = <开放接口应用的 AppID>
|
@@ -1,12 +1,12 @@
|
|
1
1
|
LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
|
2
2
|
p115client/__init__.py,sha256=1mx7njuAlqcuEWONTjSiiGnXyyNyqOcJyNX1FMHqQ-4,214
|
3
3
|
p115client/_upload.py,sha256=RTYpM_EDFuI3O7yf08f13NdeG0iD03o_V4H6Je6Nsr8,30754
|
4
|
-
p115client/client.py,sha256=
|
5
|
-
p115client/const.py,sha256=
|
4
|
+
p115client/client.py,sha256=n6WswjfTrTZPYUJRpR1jZMowniPTYnmJrZgh_yJJlFc,772563
|
5
|
+
p115client/const.py,sha256=KqDGr9KsOnSkNVM3RIdQGptCMHbidMmZ_ffyFPiniww,7654
|
6
6
|
p115client/exception.py,sha256=O4SlfjbtI9GPjzbzJrFaFUZENJFz2qA3VDEKZfdhHbc,3590
|
7
7
|
p115client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
p115client/tool/__init__.py,sha256=NjT9rroMhLwKI7UlpSCksSsnB3GexXzxvhfunNWzjY0,386
|
9
|
-
p115client/tool/attr.py,sha256=
|
9
|
+
p115client/tool/attr.py,sha256=VRte9LuE2YG8nPIxbeetdzDJgZL5ZFVp7RzjpIXUPN4,2914
|
10
10
|
p115client/tool/download.py,sha256=-iq2JOolc4uba00wsp-Z_I03ZTFgqM4UKrfHAWpH2QA,61368
|
11
11
|
p115client/tool/edit.py,sha256=kRz-Ee7KuNNlHhcVi4uHdh9DSfF1ZxUREIhK9x4hNIE,17771
|
12
12
|
p115client/tool/export_dir.py,sha256=1r2qDuYIirtDkCBQfYXh6lbm06IStRpiom-ZjtIYdbo,24502
|
@@ -14,13 +14,13 @@ p115client/tool/fs_files.py,sha256=XTG12a_MVwYI4p1hs-xMol-AQsa8C9pWFt0BUzlQCws,1
|
|
14
14
|
p115client/tool/history.py,sha256=qquCiiOIRpxOqmyXbmdwS_qpfPkduJilM6AGuOufrYU,7462
|
15
15
|
p115client/tool/iterdir.py,sha256=j7hZXrlUWBmg-kAgTjQ36BqY-8EiF9KLmPMM2ogHRPc,199632
|
16
16
|
p115client/tool/life.py,sha256=ceweN2uNKYxigSOaBQ4Abo5u05zqppRm_P7k-_rHjcA,17301
|
17
|
-
p115client/tool/pool.py,sha256=
|
17
|
+
p115client/tool/pool.py,sha256=H65VhoNxQC6xWSL1THq_PximWnBOqB4EfU6kWBTAnlA,13946
|
18
18
|
p115client/tool/request.py,sha256=rjXuQwRganE5Z-4rfgnyPFjE4jzdQSLdIs9s0cIDshU,7043
|
19
19
|
p115client/tool/upload.py,sha256=i6laoeG7GdNO7hvCDVBy8Yv2Is800wL7O5na6a3v70g,15971
|
20
20
|
p115client/tool/util.py,sha256=0o9TrXdoPcljgxDDRdxRon41bq1OjuUYCWsR0XLfmPo,3357
|
21
21
|
p115client/tool/xys.py,sha256=vU28Px2yeQzIxxGkopJIpvV6TdOnWJ5xB6NPXpTgM0Y,10306
|
22
22
|
p115client/type.py,sha256=7kOp98uLaYqcTTCgCrb3DRcl8ukMpn7ibsnVvtw2nG8,6250
|
23
|
-
p115client-0.0.5.11.
|
24
|
-
p115client-0.0.5.11.
|
25
|
-
p115client-0.0.5.11.
|
26
|
-
p115client-0.0.5.11.
|
23
|
+
p115client-0.0.5.11.7.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
|
24
|
+
p115client-0.0.5.11.7.dist-info/METADATA,sha256=-L7lnVcxGhddkMYhCmLYObhgB-zl9vo9Bi-ocf6U_tQ,8192
|
25
|
+
p115client-0.0.5.11.7.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
26
|
+
p115client-0.0.5.11.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|