p115client 0.0.5.10.4__py3-none-any.whl → 0.0.5.11__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/tool/life.py CHANGED
@@ -137,14 +137,14 @@ def iter_life_list(
137
137
  for items in data["list"]:
138
138
  if "items" not in items:
139
139
  if start_time < items["update_time"] < end_time:
140
- yield Yield(items, identity=True)
140
+ yield Yield(items, may_await=False)
141
141
  continue
142
142
  behavior_type = items["behavior_type"]
143
143
  date = items["date"]
144
144
  for item in items["items"]:
145
145
  item["behavior_type"] = behavior_type
146
146
  item["date"] = date
147
- yield Yield(item, identity=True)
147
+ yield Yield(item, may_await=False)
148
148
  if behavior_type.startswith("upload_") or items["total"] > len(items["items"]):
149
149
  seen_items: set[str] = {item["id"] for item in items["items"]}
150
150
  payload = {"offset": 0, "limit": 32, "type": behavior_type, "date": date}
@@ -158,7 +158,7 @@ def iter_life_list(
158
158
  seen_items.add(item["id"])
159
159
  item["behavior_type"] = behavior_type
160
160
  item["date"] = date
161
- yield Yield(item, identity=True)
161
+ yield Yield(item, may_await=False)
162
162
  else:
163
163
  if not resp["data"]["next_page"]:
164
164
  break
@@ -172,7 +172,7 @@ def iter_life_list(
172
172
  else:
173
173
  sleep(1 - diff)
174
174
  end_time = int(time())
175
- return run_gen_step_iter(gen_step, async_=async_)
175
+ return run_gen_step_iter(gen_step, simple=True, async_=async_)
176
176
 
177
177
 
178
178
  @overload
@@ -262,7 +262,7 @@ def iter_life_behavior_once(
262
262
  return
263
263
  fid = event["file_id"]
264
264
  if fid not in seen:
265
- yield Yield(event, identity=True)
265
+ yield Yield(event, may_await=False)
266
266
  seen_add(fid)
267
267
  offset += len(events)
268
268
  if offset >= int(resp["data"]["count"]):
@@ -276,7 +276,7 @@ def iter_life_behavior_once(
276
276
  ts_last_call = time()
277
277
  resp = yield life_behavior_detail(payload, async_=async_)
278
278
  events = check_response(resp)["data"]["list"]
279
- return run_gen_step_iter(gen_step, async_=async_)
279
+ return run_gen_step_iter(gen_step, simple=True, async_=async_)
280
280
 
281
281
 
282
282
  @overload
@@ -376,8 +376,8 @@ def iter_life_behavior(
376
376
  sub_first_loop = False
377
377
  if not type and ignore_types and event["type"] in ignore_types:
378
378
  continue
379
- yield Yield(event, identity=True)
380
- return run_gen_step_iter(gen_step, async_=async_)
379
+ yield Yield(event, may_await=False)
380
+ return run_gen_step_iter(gen_step, simple=True, async_=async_)
381
381
 
382
382
 
383
383
  @overload
@@ -468,6 +468,6 @@ def iter_life_behavior_list(
468
468
  if not type and ignore_types and event["type"] in ignore_types:
469
469
  continue
470
470
  push(event)
471
- yield Yield(ls, identity=True)
472
- return run_gen_step_iter(gen_step, async_=async_)
471
+ yield Yield(ls, may_await=False)
472
+ return run_gen_step_iter(gen_step, simple=True, async_=async_)
473
473
 
p115client/tool/pool.py CHANGED
@@ -88,7 +88,7 @@ def generate_auth_factory(
88
88
  "authorization": "Bearer " + resp["data"]["access_token"],
89
89
  "app_id": str(app_id),
90
90
  }
91
- return run_gen_step(gen_step, async_=async_)
91
+ return run_gen_step(gen_step, simple=True, async_=async_)
92
92
  return make_cookies
93
93
 
94
94
 
@@ -142,7 +142,7 @@ def generate_cookies_factory(
142
142
  "cookie": "; ".join(f"{k}={v}" for k, v in resp["data"]["cookie"].items()),
143
143
  "app": app,
144
144
  }
145
- return run_gen_step(gen_step, async_=async_)
145
+ return run_gen_step(gen_step, simple=True, async_=async_)
146
146
  return make_cookies
147
147
 
148
148
 
@@ -165,7 +165,7 @@ def generate_client_factory(
165
165
  def gen_step():
166
166
  headers = yield call(async_=async_)
167
167
  return cls(headers["cookie"])
168
- return run_gen_step(gen_step, async_=async_)
168
+ return run_gen_step(gen_step, simple=True, async_=async_)
169
169
  return make_client
170
170
 
171
171
 
@@ -215,7 +215,7 @@ def make_pool[T](
215
215
  value = generate()
216
216
  val = ComparedWithID(value)
217
217
  return value, partial(heappush, heap_, (time(), val))
218
- return run_gen_step(call, async_=async_)
218
+ return run_gen_step(call, simple=True, async_=async_)
219
219
  if not lock:
220
220
  setattr(get_value, "heap", heap_)
221
221
  return get_value
@@ -377,7 +377,7 @@ def call_wrap_with_pool(get_cert_headers: Callable, /, func: Callable) -> Callab
377
377
  if not isinstance(e, (AuthenticationError, LoginError)) and get_status_code(e) != 405:
378
378
  revert()
379
379
  raise
380
- return run_gen_step(gen_step, async_=async_)
380
+ return run_gen_step(gen_step, simple=True, async_=async_)
381
381
  return update_wrapper(wrapper, func)
382
382
 
383
383
 
p115client/tool/upload.py CHANGED
@@ -418,12 +418,12 @@ def iter_115_to_115_resume(
418
418
  if async_:
419
419
  return YieldFrom(
420
420
  taskgroup_map(upload, from_files, arg_func=get_pid, max_workers=max_workers),
421
- identity=True,
421
+ may_await=False,
422
422
  )
423
423
  else:
424
424
  return YieldFrom(
425
425
  threadpool_map(upload, from_files, arg_func=get_pid, max_workers=max_workers),
426
- identity=True,
426
+ may_await=False,
427
427
  )
428
- return run_gen_step_iter(gen_step, async_=async_)
428
+ return run_gen_step_iter(gen_step, simple=True, async_=async_)
429
429
 
p115client/tool/xys.py CHANGED
@@ -59,7 +59,7 @@ def wish_info(
59
59
  )
60
60
  check_response(resp)
61
61
  return resp["data"]
62
- return run_gen_step(gen_step, async_=async_)
62
+ return run_gen_step(gen_step, simple=True, async_=async_)
63
63
 
64
64
 
65
65
  @overload
@@ -110,7 +110,7 @@ def wish_make(
110
110
  )
111
111
  check_response(resp)
112
112
  return P115StrID(resp["data"]["xys_id"], resp["data"])
113
- return run_gen_step(gen_step, async_=async_)
113
+ return run_gen_step(gen_step, simple=True, async_=async_)
114
114
 
115
115
 
116
116
  @overload
@@ -146,6 +146,9 @@ def wish_answer(
146
146
  ) -> P115StrID | Coroutine[Any, Any, P115StrID]:
147
147
  """许愿树活动:创建助愿(助愿创建后需要等审核)
148
148
 
149
+ .. note::
150
+ 如果从未调用过 `wish_info(client, wish_id)`,请先调用,否则会报参数错误
151
+
149
152
  :param client: 115 客户端或 cookies
150
153
  :param wish_id: 许愿 id
151
154
  :param content: 助愿内容
@@ -167,7 +170,7 @@ def wish_answer(
167
170
  )
168
171
  check_response(resp)
169
172
  return P115StrID(resp["data"]["aid_id"], resp["data"])
170
- return run_gen_step(gen_step, async_=async_)
173
+ return run_gen_step(gen_step, simple=True, async_=async_)
171
174
 
172
175
 
173
176
  @overload
@@ -323,11 +326,11 @@ def wish_iter(
323
326
  )
324
327
  check_response(resp)
325
328
  ls = resp["data"]["list"]
326
- yield YieldFrom(ls, identity=True)
329
+ yield YieldFrom(ls, may_await=False)
327
330
  if not ls:
328
331
  break
329
332
  payload["page"] += 1
330
- return run_gen_step_iter(gen_step, async_=async_)
333
+ return run_gen_step_iter(gen_step, simple=True, async_=async_)
331
334
 
332
335
 
333
336
  @overload
@@ -382,11 +385,11 @@ def wish_aid_iter(
382
385
  )
383
386
  check_response(resp)
384
387
  ls = resp["data"]["list"]
385
- yield YieldFrom(ls, identity=True)
388
+ yield YieldFrom(ls, may_await=False)
386
389
  if not ls:
387
390
  break
388
391
  payload["page"] += 1
389
- return run_gen_step_iter(gen_step, async_=async_)
392
+ return run_gen_step_iter(gen_step, simple=True, async_=async_)
390
393
 
391
394
 
392
395
  # TODO: 再实现一个漂流瓶
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: p115client
3
- Version: 0.0.5.10.4
3
+ Version: 0.0.5.11
4
4
  Summary: Python 115 webdisk client.
5
5
  Home-page: https://github.com/ChenyangGao/p115client
6
6
  License: MIT
@@ -23,8 +23,8 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
23
  Requires-Dist: aiofile
24
24
  Requires-Dist: ed2k (>=0.0.2.1)
25
25
  Requires-Dist: http_response (>=0.0.2.2)
26
- Requires-Dist: httpx
27
- Requires-Dist: httpx_request (>=0.1.3)
26
+ Requires-Dist: httpx (>=0.28)
27
+ Requires-Dist: httpx_request (>=0.1.4)
28
28
  Requires-Dist: iter_collect (>=0.0.5.1)
29
29
  Requires-Dist: multidict
30
30
  Requires-Dist: orjson
@@ -40,7 +40,7 @@ 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
42
  Requires-Dist: python-httpfile (>=0.0.5.2)
43
- Requires-Dist: python-iterutils (>=0.1.11)
43
+ Requires-Dist: python-iterutils (>=0.2)
44
44
  Requires-Dist: python-property (>=0.0.3)
45
45
  Requires-Dist: python-startfile (>=0.0.2)
46
46
  Requires-Dist: python-undefined (>=0.0.3)
@@ -247,7 +247,7 @@ class MyCustom115Client(P115Client):
247
247
 
248
248
  ### 3. 检查响应
249
249
 
250
- 接口被调用后,如果返回的是 dict 类型的数据(说明原本是 JSON),则可以用 `p115client.check_response` 执行检查。首先会查看其中名为 "state" 的键的对应值,如果为 True、1 或不存在,则原样返回被检查的数据;否则,"state" 的对应值大概是 False 或 0,说明有问题出现,会根据实际情况抛出一个异常,但都是 `OSError` 的实例,其中大部分还是 `p115client.P115OSError` 的实例。
250
+ 接口被调用后,如果返回的是 dict 类型的数据(说明原本是 JSON),则可以用 `p115client.check_response` 执行检查。首先会查看其中名为 "state" 的键的对应值,如果为 True、1 或不存在,则原样返回被检查的数据;否则,"state" 的对应值大概是 False 或 0,说明有问题出现,会根据实际情况抛出一个异常,但都是 `p115client.P115OSError` 的实例。
251
251
 
252
252
  ```python
253
253
  from p115client import check_response
@@ -0,0 +1,26 @@
1
+ LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
2
+ p115client/__init__.py,sha256=1mx7njuAlqcuEWONTjSiiGnXyyNyqOcJyNX1FMHqQ-4,214
3
+ p115client/_upload.py,sha256=eOBCQCiRApZucMglBLFGD8n6LKW1Q36Ua00G-x4lHQA,30758
4
+ p115client/client.py,sha256=EyWRveHMzhPFnndMTTDCEwWnelG4mNv1RSHNAnqVEvU,768952
5
+ p115client/const.py,sha256=Ks8eYjHYApxlkelVCbSJlpmlCYtbk8fX80jETV72BTY,7754
6
+ p115client/exception.py,sha256=O4SlfjbtI9GPjzbzJrFaFUZENJFz2qA3VDEKZfdhHbc,3590
7
+ p115client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ p115client/tool/__init__.py,sha256=NjT9rroMhLwKI7UlpSCksSsnB3GexXzxvhfunNWzjY0,386
9
+ p115client/tool/attr.py,sha256=MoLSDaa53nlvkDQOgX1Nq7CaCeO3I4tTkR9oq62dBGI,2896
10
+ p115client/tool/download.py,sha256=5P6Zvy8bO3DNj08Wrn7n0Ckhqj_f9gSVjfMAUhl9BPI,61646
11
+ p115client/tool/edit.py,sha256=F8FhtyBjXRQ7TroNTM8SMG3s9TmCRoDsHId2fGalxW4,17756
12
+ p115client/tool/export_dir.py,sha256=arLsge0C2tEIX3zx7zbgbsj8cplx6uFvg1GL1QKD080,24595
13
+ p115client/tool/fs_files.py,sha256=uo_2x8Nq1KTagNl2YdM8jRzp97pg513OVo280BK74xU,15645
14
+ p115client/tool/history.py,sha256=NhEx_Zc92rz8ois2OQ4b7lmGkjrACd4Of_nqQlZhEaM,7488
15
+ p115client/tool/iterdir.py,sha256=myqQea5l033fJxuoMWqNxP84qALWI2ZXfSlYDNf4dW8,200172
16
+ p115client/tool/life.py,sha256=bK2xZsgDfxTp1hWbxXZ6pWrnC1HmaWZv1c5q2s3CbaI,17387
17
+ p115client/tool/pool.py,sha256=EO_dmtcGBWCnbWqgoaGMsJGhIaCUQ-rdc5qC-oaseq8,14018
18
+ p115client/tool/request.py,sha256=rjXuQwRganE5Z-4rfgnyPFjE4jzdQSLdIs9s0cIDshU,7043
19
+ p115client/tool/upload.py,sha256=dbvYTD8TD_3iEGChUdchOXqnV0VLHX7TJlb2zBHduNM,15932
20
+ p115client/tool/util.py,sha256=0o9TrXdoPcljgxDDRdxRon41bq1OjuUYCWsR0XLfmPo,3357
21
+ p115client/tool/xys.py,sha256=NVwXXB1ZvFKQKcar1kQdDzlUN7xilGheO_eEeoMxjMw,10325
22
+ p115client/type.py,sha256=7kOp98uLaYqcTTCgCrb3DRcl8ukMpn7ibsnVvtw2nG8,6250
23
+ p115client-0.0.5.11.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
24
+ p115client-0.0.5.11.dist-info/METADATA,sha256=9HPewST9HgcH9KvyLMa7lDSh-8YJE8KsVcDUeTt-sBo,8236
25
+ p115client-0.0.5.11.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
26
+ p115client-0.0.5.11.dist-info/RECORD,,
@@ -1,26 +0,0 @@
1
- LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
2
- p115client/__init__.py,sha256=1mx7njuAlqcuEWONTjSiiGnXyyNyqOcJyNX1FMHqQ-4,214
3
- p115client/_upload.py,sha256=DOckFLU_P7Fl0BNu_0-2od6pPsCnzroYY6zZE5_EMnM,30735
4
- p115client/client.py,sha256=98Zf8CzxeSPcU-U7LUd9KMY2WON7F90kGSokbVcqqXU,727434
5
- p115client/const.py,sha256=AMyL3QZ172f_RaEkfh27DQxwbkXvPhqfeBWHWTrvSLY,7754
6
- p115client/exception.py,sha256=kQMI7lwkFIC_tRuj1HT8zqi5HGzz6fTxgK7B1aKrNTI,3447
7
- p115client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- p115client/tool/__init__.py,sha256=NjT9rroMhLwKI7UlpSCksSsnB3GexXzxvhfunNWzjY0,386
9
- p115client/tool/attr.py,sha256=u_5JM2LlWFT4IHF2zlz-DY4llgmw4mwouEKMae8BZdQ,2841
10
- p115client/tool/download.py,sha256=3zoxkLPf4Jya-wYowZJmZR65sR3GWNWNmnevKrrgvQY,60509
11
- p115client/tool/edit.py,sha256=eRlR1UZMpfGnoetpqSAAx5bPBOEiSlx7HPkpOSs5agk,17739
12
- p115client/tool/export_dir.py,sha256=iMnKtnESi8HKvW9WhIvOdEoMXSBpAnhFlGeyKXHpQbE,24545
13
- p115client/tool/fs_files.py,sha256=jY57L4nhB9t-2kT_1j3mdiwOdPZKsimN3eN5mUJAqMI,15745
14
- p115client/tool/history.py,sha256=2S26BH7uBNfVHlbYFNy-aNOLMcM-HrlR7TLHAZacUJI,7458
15
- p115client/tool/iterdir.py,sha256=Qgs1fHwfgCXb-9T_1WQfyhnfXe8LZYwZY7oMTnCz3tQ,192038
16
- p115client/tool/life.py,sha256=X6Bp0GYKwnZeWlttE2DIVw5iOCXM5QzIkM6Zuj24c5Y,17323
17
- p115client/tool/pool.py,sha256=K-ALC-JEwik3DYCr5Eckok15oQnHRe6yznKIuJ9jyyM,13953
18
- p115client/tool/request.py,sha256=rjXuQwRganE5Z-4rfgnyPFjE4jzdQSLdIs9s0cIDshU,7043
19
- p115client/tool/upload.py,sha256=qK1OQYxP-Faq2eMDhc5sBXJiSr8m8EZ_gb0O_iA2TrI,15915
20
- p115client/tool/util.py,sha256=0o9TrXdoPcljgxDDRdxRon41bq1OjuUYCWsR0XLfmPo,3357
21
- p115client/tool/xys.py,sha256=WMTisCyN4eYyv4A14yYOpjud2mBhQvBcUHOp6pJUQeA,10140
22
- p115client/type.py,sha256=7kOp98uLaYqcTTCgCrb3DRcl8ukMpn7ibsnVvtw2nG8,6250
23
- p115client-0.0.5.10.4.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
24
- p115client-0.0.5.10.4.dist-info/METADATA,sha256=-zPTpPGe0IpuPfetzVHdvKDXQ9PGxPIu--dw7MFJxns,8276
25
- p115client-0.0.5.10.4.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
26
- p115client-0.0.5.10.4.dist-info/RECORD,,