p115client 0.0.5.9.1__py3-none-any.whl → 0.0.5.9.3__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 CHANGED
@@ -5427,7 +5427,7 @@ class P115Client(P115OpenClient):
5427
5427
  headers["cookie"] = self.cookies_str
5428
5428
  for i in count(0):
5429
5429
  try:
5430
- if need_fetch_cert_first is None:
5430
+ if fetch_cert_headers is None:
5431
5431
  if is_open_api:
5432
5432
  cert: str = headers["authorization"]
5433
5433
  else:
p115client/tool/pool.py CHANGED
@@ -6,12 +6,12 @@ from __future__ import annotations
6
6
  __author__ = "ChenyangGao <https://chenyanggao.github.io>"
7
7
  __all__ = [
8
8
  "generate_auth_factory", "generate_cookies_factory", "generate_client_factory",
9
- "auth_pool", "cookies_pool", "client_pool", "call_wrap_with_pool",
9
+ "make_pool", "auth_pool", "cookies_pool", "client_pool", "call_wrap_with_pool",
10
10
  ]
11
11
  __doc__ = "这个模块提供了一些和 cookies 池有关的函数"
12
12
 
13
13
  from asyncio import Lock as AsyncLock
14
- from collections.abc import Callable, Iterable
14
+ from collections.abc import Callable, Iterable, Mapping
15
15
  from functools import partial, total_ordering, update_wrapper
16
16
  from heapq import heappop, heappush, heapify
17
17
  from itertools import cycle, repeat
@@ -365,23 +365,33 @@ def call_wrap_with_pool(get_cert_headers: Callable, /, func: Callable) -> Callab
365
365
  :param get_cert_headers: 获取认证信息的请求头的函数
366
366
  :param func: 执行请求的函数
367
367
  """
368
- def wrapper(*args, headers=None, async_: bool = False, **kwds):
368
+ def wrapper(
369
+ *args,
370
+ headers: None | Mapping = None,
371
+ async_: bool = False,
372
+ **kwds,
373
+ ):
369
374
  def gen_step():
370
375
  nonlocal headers
371
376
  while True:
372
377
  if async_:
373
- cert_headers, revert = yield get_cert_headers(async_=True)
378
+ cert, revert = yield get_cert_headers(async_=True)
374
379
  else:
375
- cert_headers, revert = get_cert_headers()
376
- if headers:
377
- headers = dict(headers, **cert_headers)
378
- else:
379
- headers = cert_headers
380
+ cert, revert = get_cert_headers()
380
381
  try:
381
- if async_:
382
- resp = yield func(*args, headers=headers, async_=True, **kwds)
382
+ if isinstance(cert, Mapping):
383
+ if headers:
384
+ headers = dict(headers, **cert)
385
+ else:
386
+ headers = cert
387
+ if async_:
388
+ resp = yield func(*args, headers=headers, async_=True, **kwds)
389
+ else:
390
+ resp = func(*args, headers=headers, **kwds)
391
+ elif async_:
392
+ resp = yield func(cert, *args, headers=headers, async_=True, **kwds)
383
393
  else:
384
- resp = func(*args, headers=headers, **kwds)
394
+ resp = func(cert, *args, headers=headers, **kwds)
385
395
  if not isinstance(resp, dict) or resp.get("errno") != 40101004:
386
396
  revert()
387
397
  return resp
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: p115client
3
- Version: 0.0.5.9.1
3
+ Version: 0.0.5.9.3
4
4
  Summary: Python 115 webdisk client.
5
5
  Home-page: https://github.com/ChenyangGao/p115client
6
6
  License: MIT
@@ -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=XsOy9BVOqu2jof7rGIMUldVZSiuQNAku379kIiZPr-E,721350
4
+ p115client/client.py,sha256=SMKSwnUdsiW1ARZQkvJm-echoCiRhf365UmmOaa4cog,721347
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
@@ -13,12 +13,12 @@ p115client/tool/fs_files.py,sha256=hkezLKrtTAGPDkPxwq6jMrm8s2-unHZQBR7cDvh41qs,1
13
13
  p115client/tool/history.py,sha256=2S26BH7uBNfVHlbYFNy-aNOLMcM-HrlR7TLHAZacUJI,7458
14
14
  p115client/tool/iterdir.py,sha256=T6bsD8A896nHgVxKYu2dkIo-5Az2svL4iLm2uHQWyHg,187517
15
15
  p115client/tool/life.py,sha256=9ncoB2dNibhgOjPb9mHr873fCZmb65ZeteVLH4Tsujc,17330
16
- p115client/tool/pool.py,sha256=_3eFHTHW5Bhs17AwF8awitE4n1UuvFGIkZUZ-saJ7zQ,14233
16
+ p115client/tool/pool.py,sha256=eT_feALidGdvSFppivxC1f_ipR42fWav-X1sutdpkco,14608
17
17
  p115client/tool/request.py,sha256=SWsezW9EYZGS3R-TbZxMG-8bN3YWJ0-GzgvKlvRBSCM,7042
18
18
  p115client/tool/upload.py,sha256=qK1OQYxP-Faq2eMDhc5sBXJiSr8m8EZ_gb0O_iA2TrI,15915
19
19
  p115client/tool/xys.py,sha256=n89n9OLBXx6t20L61wJgfrP6V4jW3sHgyaQNBLdUwUQ,3578
20
20
  p115client/type.py,sha256=e4g9URQBE23XN2dGomldj8wC6NlDWBBSVC5Bmd8giBc,5993
21
- p115client-0.0.5.9.1.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
22
- p115client-0.0.5.9.1.dist-info/METADATA,sha256=_NxUFNOa5O4B2Ek-NsKRlEFhR-sWQ5OUZT8G2Xe1nFY,8233
23
- p115client-0.0.5.9.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
24
- p115client-0.0.5.9.1.dist-info/RECORD,,
21
+ p115client-0.0.5.9.3.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
22
+ p115client-0.0.5.9.3.dist-info/METADATA,sha256=RbAiZhKxVWP0ZGX2gkMQgjYvuJsqzFy-Po66W_Wwd6Q,8233
23
+ p115client-0.0.5.9.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
24
+ p115client-0.0.5.9.3.dist-info/RECORD,,