p115client 0.0.5.10.7__tar.gz → 0.0.5.10.8__tar.gz

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.
Files changed (25) hide show
  1. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/PKG-INFO +3 -3
  2. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/client.py +107 -1
  3. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/pyproject.toml +3 -3
  4. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/LICENSE +0 -0
  5. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/__init__.py +0 -0
  6. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/_upload.py +0 -0
  7. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/const.py +0 -0
  8. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/exception.py +0 -0
  9. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/py.typed +0 -0
  10. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/tool/__init__.py +0 -0
  11. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/tool/attr.py +0 -0
  12. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/tool/download.py +0 -0
  13. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/tool/edit.py +0 -0
  14. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/tool/export_dir.py +0 -0
  15. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/tool/fs_files.py +0 -0
  16. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/tool/history.py +0 -0
  17. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/tool/iterdir.py +0 -0
  18. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/tool/life.py +0 -0
  19. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/tool/pool.py +0 -0
  20. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/tool/request.py +0 -0
  21. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/tool/upload.py +0 -0
  22. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/tool/util.py +0 -0
  23. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/tool/xys.py +0 -0
  24. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/p115client/type.py +0 -0
  25. {p115client-0.0.5.10.7 → p115client-0.0.5.10.8}/readme.md +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: p115client
3
- Version: 0.0.5.10.7
3
+ Version: 0.0.5.10.8
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
@@ -4489,6 +4489,10 @@ class P115Client(P115OpenClient):
4489
4489
  """
4490
4490
  self.cookies = None
4491
4491
 
4492
+ @locked_cacheproperty
4493
+ def request_kwargs(self, /) -> dict:
4494
+ return {}
4495
+
4492
4496
  @locked_cacheproperty
4493
4497
  def user_id(self, /) -> int:
4494
4498
  cookie_uid = self.cookies.get("UID")
@@ -5420,7 +5424,7 @@ class P115Client(P115OpenClient):
5420
5424
  return None
5421
5425
  return self.logout_by_ssoent(ssoent, async_=async_, **request_kwargs)
5422
5426
 
5423
- def request(
5427
+ def _request(
5424
5428
  self,
5425
5429
  /,
5426
5430
  url: str,
@@ -5662,6 +5666,90 @@ class P115Client(P115OpenClient):
5662
5666
  return resp
5663
5667
  return run_gen_step(gen_step, async_=async_)
5664
5668
 
5669
+ def request(
5670
+ self,
5671
+ /,
5672
+ url: str,
5673
+ method: str = "GET",
5674
+ params = None,
5675
+ data = None,
5676
+ *,
5677
+ async_: Literal[False, True] = False,
5678
+ **request_kwargs,
5679
+ ):
5680
+ """帮助函数:可执行同步和异步的网络请求
5681
+
5682
+ :param url: HTTP 的请求链接
5683
+ :param method: HTTP 的请求方法
5684
+ :param params: 查询参数
5685
+ :param check: 是否用 `check_response` 函数检查返回值
5686
+ :param ecdh_encrypt: 使用 ecdh 算法进行加密(返回值也要解密)
5687
+ :param fetch_cert_headers: 调用以获取认证信息头
5688
+ :param revert_cert_headers: 调用以退还认证信息头
5689
+ :param async_: 说明 `request` 是同步调用还是异步调用
5690
+ :param request: HTTP 请求调用,如果为 None,则默认用 httpx 执行请求
5691
+ 如果传入调用,则必须至少能接受以下几个关键词参数:
5692
+
5693
+ - url: HTTP 的请求链接
5694
+ - method: HTTP 的请求方法
5695
+ - headers: HTTP 的请求头
5696
+ - data: HTTP 的请求体
5697
+ - parse: 解析 HTTP 响应的方法,默认会构建一个 Callable,会把响应的字节数据视为 JSON 进行反序列化解析
5698
+
5699
+ - 如果为 None,则直接把响应对象返回
5700
+ - 如果为 ...(Ellipsis),则把响应对象关闭后将其返回
5701
+ - 如果为 True,则根据响应头来确定把响应得到的字节数据解析成何种格式(反序列化),请求也会被自动关闭
5702
+ - 如果为 False,则直接返回响应得到的字节数据,请求也会被自动关闭
5703
+ - 如果为 Callable,则使用此调用来解析数据,接受 1-2 个位置参数,并把解析结果返回给 `request` 的调用者,请求也会被自动关闭
5704
+ - 如果只接受 1 个位置参数,则把响应对象传给它
5705
+ - 如果能接受 2 个位置参数,则把响应对象和响应得到的字节数据(响应体)传给它
5706
+
5707
+ :param request_kwargs: 其余的请求参数,会被传给 `request`
5708
+
5709
+ :return: 直接返回 `request` 执行请求后的返回值
5710
+
5711
+ .. note::
5712
+ `request` 可以由不同的请求库来提供,下面是封装了一些模块
5713
+
5714
+ 1. `httpx_request <https://pypi.org/project/httpx_request/>`_,由 `httpx <https://pypi.org/project/httpx/>`_ 封装,支持同步和异步调用,本模块默认用的就是这个封装
5715
+
5716
+ .. code:: python
5717
+
5718
+ from httpx_request import request
5719
+
5720
+ 2. `python-urlopen <https://pypi.org/project/python-urlopen/>`_,由 `urllib.request.urlopen <https://docs.python.org/3/library/urllib.request.html#urllib.request.urlopen>`_ 封装,支持同步调用,性能相对最差
5721
+
5722
+ .. code:: python
5723
+
5724
+ from urlopen import request
5725
+
5726
+ 3. `urllib3_request <https://pypi.org/project/urllib3_request/>`_,由 `urllib3 <https://pypi.org/project/urllib3/>`_ 封装,支持同步调用,性能相对较好,推荐使用
5727
+
5728
+ .. code:: python
5729
+
5730
+ from urllib3_request import request
5731
+
5732
+ 4. `requests_request <https://pypi.org/project/requests_request/>`_,由 `requests <https://pypi.org/project/requests/>`_ 封装,支持同步调用
5733
+
5734
+ .. code:: python
5735
+
5736
+ from requests_request import request
5737
+
5738
+ 5. `aiohttp_client_request <https://pypi.org/project/aiohttp_client_request/>`_,由 `aiohttp <https://pypi.org/project/aiohttp/>`_ 封装,支持异步调用,异步并发能力最强,推荐使用
5739
+
5740
+ .. code:: python
5741
+
5742
+ from aiohttp_client_request import request
5743
+
5744
+ 6. `blacksheep_client_request <https://pypi.org/project/blacksheep_client_request/>`_,由 `blacksheep <https://pypi.org/project/blacksheep/>`_ 封装,支持异步调用
5745
+
5746
+ .. code:: python
5747
+
5748
+ from blacksheep_client_request import request
5749
+ """
5750
+ kwargs = {**self.request_kwargs, **request_kwargs}
5751
+ return self._request(url, method, params, data, async_=async_, **kwargs)
5752
+
5665
5753
  ########## Activity API ##########
5666
5754
 
5667
5755
  @overload
@@ -15047,6 +15135,13 @@ class P115Client(P115OpenClient):
15047
15135
  async_: Literal[False, True] = False,
15048
15136
  **request_kwargs,
15049
15137
  ) -> dict | Coroutine[Any, Any, dict]:
15138
+ """获取某个开放应用的授权信息
15139
+
15140
+ GET https://qrcodeapi.115.com/app/1.0/web/1.0/user/getAppAuthDetail
15141
+
15142
+ :payload:
15143
+ - auth_id: int | str 💡 授权 id
15144
+ """
15050
15145
  api = complete_api(f"/app/1.0/{app}/1.0/user/getAppAuthDetail", base_url=base_url)
15051
15146
  if isinstance(payload, (int, str)):
15052
15147
  payload = {"auth_id": payload}
@@ -15083,6 +15178,10 @@ class P115Client(P115OpenClient):
15083
15178
  async_: Literal[False, True] = False,
15084
15179
  **request_kwargs,
15085
15180
  ) -> dict | Coroutine[Any, Any, dict]:
15181
+ """获取所有授权的开放应用的列表
15182
+
15183
+ GET https://qrcodeapi.115.com/app/1.0/web/1.0/user/getAppAuthList
15184
+ """
15086
15185
  api = complete_api(f"/app/1.0/{app}/1.0/user/getAppAuthList", base_url=base_url)
15087
15186
  return self.request(url=api, async_=async_, **request_kwargs)
15088
15187
 
@@ -15120,6 +15219,13 @@ class P115Client(P115OpenClient):
15120
15219
  async_: Literal[False, True] = False,
15121
15220
  **request_kwargs,
15122
15221
  ) -> dict | Coroutine[Any, Any, dict]:
15222
+ """取消某个开放应用的授权
15223
+
15224
+ GET https://qrcodeapi.115.com/app/1.0/web/1.0/user/deauthApp
15225
+
15226
+ :payload:
15227
+ - auth_id: int | str 💡 授权 id
15228
+ """
15123
15229
  api = complete_api(f"/app/1.0/{app}/1.0/user/deauthApp", base_url=base_url)
15124
15230
  if isinstance(payload, (int, str)):
15125
15231
  payload = {"auth_id": payload}
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "p115client"
3
- version = "0.0.5.10.7"
3
+ version = "0.0.5.10.8"
4
4
  description = "Python 115 webdisk client."
5
5
  authors = ["ChenyangGao <wosiwujm@gmail.com>"]
6
6
  license = "MIT"
@@ -31,8 +31,8 @@ python = "^3.12"
31
31
  aiofile = "*"
32
32
  ed2k = ">=0.0.2.1"
33
33
  http_response = ">=0.0.2.2"
34
- httpx = "*"
35
- httpx_request = ">=0.1.3"
34
+ httpx = ">=0.28"
35
+ httpx_request = ">=0.1.4"
36
36
  iter_collect = ">=0.0.5.1"
37
37
  multidict = "*"
38
38
  orjson = "*"
File without changes