p123client 0.0.6.2__py3-none-any.whl → 0.0.6.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.
p123client/client.py CHANGED
@@ -107,6 +107,20 @@ def dict_to_lower_merge[K, V](
107
107
  return m
108
108
 
109
109
 
110
+ def update_headers_in_kwargs(
111
+ request_kwargs: dict,
112
+ /,
113
+ *args,
114
+ **kwargs,
115
+ ):
116
+ if headers := request_kwargs.get("headers"):
117
+ headers = dict(headers)
118
+ else:
119
+ headers = {}
120
+ headers.update(*args, **kwargs)
121
+ request_kwargs["headers"] = headers
122
+
123
+
110
124
  def escape_filename(
111
125
  s: str,
112
126
  /,
@@ -961,6 +975,7 @@ class P123OpenClient:
961
975
  - fileId: int 💡 文件 id
962
976
  """
963
977
  api = complete_url("/api/v1/file/download_info", base_url)
978
+ update_headers_in_kwargs(request_kwargs, platform="android")
964
979
  if not isinstance(payload, dict):
965
980
  payload = {"fileId": payload}
966
981
  return self.request(api, params=payload, async_=async_, **request_kwargs)
@@ -4506,12 +4521,7 @@ class P123Client(P123OpenClient):
4506
4521
  """
4507
4522
  def gen_step():
4508
4523
  nonlocal payload
4509
- if headers := request_kwargs.get("headers"):
4510
- headers = dict(headers)
4511
- else:
4512
- headers = {}
4513
- headers["platform"] = "android"
4514
- request_kwargs["headers"] = headers
4524
+ update_headers_in_kwargs(request_kwargs, platform="android")
4515
4525
  if not isinstance(payload, dict):
4516
4526
  resp = yield self.fs_info(
4517
4527
  payload,
@@ -5904,12 +5914,7 @@ class P123Client(P123OpenClient):
5904
5914
  payload = self
5905
5915
  self = None
5906
5916
  assert payload is not None
5907
- if headers := request_kwargs.get("headers"):
5908
- headers = dict(headers)
5909
- else:
5910
- headers = {}
5911
- headers["platform"] = "android"
5912
- request_kwargs["headers"] = headers
5917
+ update_headers_in_kwargs(request_kwargs, platform="android")
5913
5918
  api = complete_url("share/download/info", base_url)
5914
5919
  if self is None:
5915
5920
  request_kwargs.setdefault("parse", default_parse)
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: p123client
3
- Version: 0.0.6.2
3
+ Version: 0.0.6.3
4
4
  Summary: Python 123 webdisk client.
5
- Home-page: https://github.com/ChenyangGao/python-123-client
5
+ Home-page: https://github.com/ChenyangGao/p123client
6
6
  License: MIT
7
7
  Keywords: 123,webdisk,client
8
8
  Author: ChenyangGao
@@ -34,7 +34,7 @@ Requires-Dist: python-httpfile (>=0.0.5)
34
34
  Requires-Dist: python-iterutils (>=0.2)
35
35
  Requires-Dist: python-property (>=0.0.3)
36
36
  Requires-Dist: yarl
37
- Project-URL: Repository, https://github.com/ChenyangGao/python-123-client
37
+ Project-URL: Repository, https://github.com/ChenyangGao/p123client
38
38
  Description-Content-Type: text/markdown
39
39
 
40
40
  # Python 123 网盘客户端
@@ -1,12 +1,12 @@
1
1
  LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
2
2
  p123client/__init__.py,sha256=gfUum-q3f_XuXOk2HpArDAIxAlscZm8Fau1kiNkNFpg,214
3
- p123client/client.py,sha256=AfMgAc5OY_5lTP4RXVlILImB3Cx_RSB5nMPdZZ6-YOE,246733
3
+ p123client/client.py,sha256=E4X5qEKnkDb17KGiy7CrhzKBkQ8ukFTFM6qxUzGsnVg,246781
4
4
  p123client/const.py,sha256=T17OzPQrnIG6w_Hzjc8TF_fFMKa-hQMSn1gff8pVcBc,56
5
5
  p123client/exception.py,sha256=020xGo8WQmGCJz1UzNg9oFzpEvToQcgTye0s6lkFASQ,1540
6
6
  p123client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  p123client/tool/__init__.py,sha256=2k_tcc67O9QG4wzESIdnAwqNHybCGlrsnxo_uBqBhEI,16673
8
8
  p123client/type.py,sha256=T17OzPQrnIG6w_Hzjc8TF_fFMKa-hQMSn1gff8pVcBc,56
9
- p123client-0.0.6.2.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
10
- p123client-0.0.6.2.dist-info/METADATA,sha256=J1kKf76ITb6pxdXOW4GE7Rpxto3UncAUf1nVDO2VTbc,8869
11
- p123client-0.0.6.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
12
- p123client-0.0.6.2.dist-info/RECORD,,
9
+ p123client-0.0.6.3.dist-info/LICENSE,sha256=o5242_N2TgDsWwFhPn7yr8YJNF7XsJM5NxUMtcT97bc,1100
10
+ p123client-0.0.6.3.dist-info/METADATA,sha256=MgwA-g5ZGjXIchhxrFkYLPIoPeVJU96399yiIkxlBPw,8855
11
+ p123client-0.0.6.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
12
+ p123client-0.0.6.3.dist-info/RECORD,,