p123client 0.0.6.7__tar.gz → 0.0.6.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: p123client
3
- Version: 0.0.6.7
3
+ Version: 0.0.6.8
4
4
  Summary: Python 123 webdisk client.
5
5
  Home-page: https://github.com/ChenyangGao/p123client
6
6
  License: MIT
@@ -4459,6 +4459,45 @@ class P123Client(P123OpenClient):
4459
4459
  request_kwargs["async_"] = async_
4460
4460
  return request(**request_kwargs)
4461
4461
 
4462
+ @overload
4463
+ @staticmethod
4464
+ def app_server_time(
4465
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
4466
+ request: None | Callable = None,
4467
+ *,
4468
+ async_: Literal[False] = False,
4469
+ **request_kwargs,
4470
+ ) -> dict:
4471
+ ...
4472
+ @overload
4473
+ @staticmethod
4474
+ def app_server_time(
4475
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
4476
+ request: None | Callable = None,
4477
+ *,
4478
+ async_: Literal[True],
4479
+ **request_kwargs,
4480
+ ) -> Coroutine[Any, Any, dict]:
4481
+ ...
4482
+ @staticmethod
4483
+ def app_server_time(
4484
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
4485
+ request: None | Callable = None,
4486
+ *,
4487
+ async_: Literal[False, True] = False,
4488
+ **request_kwargs,
4489
+ ) -> dict | Coroutine[Any, Any, dict]:
4490
+ """获取 123 网盘的服务器时间戳
4491
+
4492
+ GET https://www.123pan.com/api/get/server/time
4493
+ """
4494
+ request_kwargs["url"] = complete_url("/api/get/server/time", base_url)
4495
+ request_kwargs.setdefault("parse", default_parse)
4496
+ if request is None:
4497
+ request = get_default_request()
4498
+ request_kwargs["async_"] = async_
4499
+ return request(**request_kwargs)
4500
+
4462
4501
  @overload
4463
4502
  def download_info(
4464
4503
  self,
@@ -5151,7 +5190,7 @@ class P123Client(P123OpenClient):
5151
5190
  - next: int = 0 💡 下一批拉取开始的 id
5152
5191
  - orderBy: str = "file_id" 💡 排序依据
5153
5192
 
5154
- - "file_id": 文件 id
5193
+ - "fileId": 文件 id
5155
5194
  - "file_name": 文件名
5156
5195
  - "size": 文件大小
5157
5196
  - "create_at": 创建时间
@@ -5160,7 +5199,7 @@ class P123Client(P123OpenClient):
5160
5199
  - ...
5161
5200
 
5162
5201
  - orderDirection: "asc" | "desc" = "asc" 💡 排序顺序
5163
- - Page: int = <default> 💡 第几页,从 1 开始,可以是 0
5202
+ - Page: int = 1 💡 第几页,从 1 开始
5164
5203
  - parentFileId: int | str = 0 💡 父目录 id
5165
5204
  - trashed: "false" | "true" = <default> 💡 是否查看回收站的文件
5166
5205
  - inDirectSpace: "false" | "true" = "false"
@@ -5171,8 +5210,13 @@ class P123Client(P123OpenClient):
5171
5210
  - "syncFileList": 同步空间
5172
5211
 
5173
5212
  - operateType: int | str = <default> 💡 操作类型,如果在同步空间,则需要指定为 "SyncSpacePage"
5213
+
5214
+ .. note::
5215
+ 这个值似乎不影响结果,所以可以忽略。我在浏览器中,看到罗列根目录为 1,搜索(指定 `SearchData`)为 2,同步空间的根目录为 3,罗列其它目录大多为 4,偶尔为 8,也可能是其它值
5216
+
5174
5217
  - SearchData: str = <default> 💡 搜索关键字(将无视 `parentFileId` 参数)
5175
- - OnlyLookAbnormalFile: int = <default>
5218
+ - OnlyLookAbnormalFile: int = 0 💡 大概可传入 0 或 1
5219
+ - RequestSource: int = <default> 💡 浏览器中,在同步空间中为 1
5176
5220
  """
5177
5221
  if isinstance(payload, (int, str)):
5178
5222
  payload = {"parentFileId": payload}
@@ -5185,6 +5229,8 @@ class P123Client(P123OpenClient):
5185
5229
  "parentFileId": 0,
5186
5230
  "inDirectSpace": "false",
5187
5231
  "event": event,
5232
+ "OnlyLookAbnormalFile": 0,
5233
+ "Page": 1,
5188
5234
  })
5189
5235
  if not payload.get("trashed"):
5190
5236
  match payload["event"]:
@@ -5322,6 +5368,50 @@ class P123Client(P123OpenClient):
5322
5368
  **request_kwargs,
5323
5369
  )
5324
5370
 
5371
+ @overload
5372
+ def fs_fresh(
5373
+ self,
5374
+ payload: dict = {},
5375
+ /,
5376
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
5377
+ *,
5378
+ async_: Literal[False] = False,
5379
+ **request_kwargs,
5380
+ ) -> dict:
5381
+ ...
5382
+ @overload
5383
+ def fs_fresh(
5384
+ self,
5385
+ payload: dict = {},
5386
+ /,
5387
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
5388
+ *,
5389
+ async_: Literal[True],
5390
+ **request_kwargs,
5391
+ ) -> Coroutine[Any, Any, dict]:
5392
+ ...
5393
+ def fs_fresh(
5394
+ self,
5395
+ payload: dict = {},
5396
+ /,
5397
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
5398
+ *,
5399
+ async_: Literal[False, True] = False,
5400
+ **request_kwargs,
5401
+ ) -> dict | Coroutine[Any, Any, dict]:
5402
+ """刷新列表和直链缓存
5403
+
5404
+ POST https://www.123pan.com/api/restful/goapi/v1/cdnLink/cache/refresh
5405
+ """
5406
+ return self.request(
5407
+ "restful/goapi/v1/cdnLink/cache/refresh",
5408
+ "POST",
5409
+ json=payload,
5410
+ base_url=base_url,
5411
+ async_=async_,
5412
+ **request_kwargs,
5413
+ )
5414
+
5325
5415
  @overload # type: ignore
5326
5416
  def fs_rename(
5327
5417
  self,
@@ -5378,6 +5468,56 @@ class P123Client(P123OpenClient):
5378
5468
  **request_kwargs,
5379
5469
  )
5380
5470
 
5471
+ @overload
5472
+ def fs_sync_log(
5473
+ self,
5474
+ payload: dict | int = 1,
5475
+ /,
5476
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
5477
+ *,
5478
+ async_: Literal[False] = False,
5479
+ **request_kwargs,
5480
+ ) -> dict:
5481
+ ...
5482
+ @overload
5483
+ def fs_sync_log(
5484
+ self,
5485
+ payload: dict | int = 1,
5486
+ /,
5487
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
5488
+ *,
5489
+ async_: Literal[True],
5490
+ **request_kwargs,
5491
+ ) -> Coroutine[Any, Any, dict]:
5492
+ ...
5493
+ def fs_sync_log(
5494
+ self,
5495
+ payload: dict | int = 1,
5496
+ /,
5497
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
5498
+ *,
5499
+ async_: Literal[False, True] = False,
5500
+ **request_kwargs,
5501
+ ) -> dict | Coroutine[Any, Any, dict]:
5502
+ """获取同步空间的操作记录
5503
+
5504
+ GET https://www.123pan.com/api/restful/goapi/v1/sync-disk/file/log
5505
+
5506
+ :payload:
5507
+ - page: int = 1 💡 第几页
5508
+ - pageSize: int = 100 💡 每页大小
5509
+ - searchData: str = <default> 💡 搜索关键字
5510
+ """
5511
+ if not isinstance(payload, dict):
5512
+ payload = {"page": payload, "pageSize": 100}
5513
+ return self.request(
5514
+ "restful/goapi/v1/sync-disk/file/log",
5515
+ params=payload,
5516
+ base_url=base_url,
5517
+ async_=async_,
5518
+ **request_kwargs,
5519
+ )
5520
+
5381
5521
  @overload # type: ignore
5382
5522
  def fs_trash(
5383
5523
  self,
@@ -5433,6 +5573,8 @@ class P123Client(P123OpenClient):
5433
5573
  - "recycleRestore": 移出回收站
5434
5574
 
5435
5575
  - operation: bool = <default>
5576
+ - operatePlace: int = <default>
5577
+ - RequestSource: int = <default>
5436
5578
  """
5437
5579
  if isinstance(payload, (int, str)):
5438
5580
  payload = {"fileTrashInfoList": [{"FileId": payload}]}
@@ -7265,6 +7407,55 @@ class P123Client(P123OpenClient):
7265
7407
  )
7266
7408
  return run_gen_step(gen_step, async_)
7267
7409
 
7410
+ @overload
7411
+ def user_device_list(
7412
+ self,
7413
+ payload: dict | str = "deviceManagement",
7414
+ /,
7415
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
7416
+ *,
7417
+ async_: Literal[False] = False,
7418
+ **request_kwargs,
7419
+ ) -> dict:
7420
+ ...
7421
+ @overload
7422
+ def user_device_list(
7423
+ self,
7424
+ payload: dict | str = "deviceManagement",
7425
+ /,
7426
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
7427
+ *,
7428
+ async_: Literal[True],
7429
+ **request_kwargs,
7430
+ ) -> Coroutine[Any, Any, dict]:
7431
+ ...
7432
+ def user_device_list(
7433
+ self,
7434
+ payload: dict | str = "deviceManagement",
7435
+ /,
7436
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
7437
+ *,
7438
+ async_: Literal[False, True] = False,
7439
+ **request_kwargs,
7440
+ ) -> dict | Coroutine[Any, Any, dict]:
7441
+ """用户设备列表
7442
+
7443
+ GET https://www.123pan.com/api/user/device_list
7444
+
7445
+ :payload:
7446
+ - event: str = "deviceManagement" 💡 事件类型,"deviceManagement" 为管理登录设备列表
7447
+ - operateType: int = <default>
7448
+ """
7449
+ if not isinstance(payload, dict):
7450
+ payload = {"event": payload}
7451
+ return self.request(
7452
+ "user/device_list",
7453
+ params=payload,
7454
+ base_url=base_url,
7455
+ async_=async_,
7456
+ **request_kwargs,
7457
+ )
7458
+
7268
7459
  @overload
7269
7460
  def user_info(
7270
7461
  self,
@@ -7357,6 +7548,54 @@ class P123Client(P123OpenClient):
7357
7548
  request_kwargs["async_"] = async_
7358
7549
  return request(url=api, method="POST", json=payload, **request_kwargs)
7359
7550
 
7551
+ @overload
7552
+ def user_use_history(
7553
+ self,
7554
+ payload: dict | str = "loginRecord",
7555
+ /,
7556
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
7557
+ *,
7558
+ async_: Literal[False] = False,
7559
+ **request_kwargs,
7560
+ ) -> dict:
7561
+ ...
7562
+ @overload
7563
+ def user_use_history(
7564
+ self,
7565
+ payload: dict | str = "loginRecord",
7566
+ /,
7567
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
7568
+ *,
7569
+ async_: Literal[True],
7570
+ **request_kwargs,
7571
+ ) -> Coroutine[Any, Any, dict]:
7572
+ ...
7573
+ def user_use_history(
7574
+ self,
7575
+ payload: dict | str = "loginRecord",
7576
+ /,
7577
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
7578
+ *,
7579
+ async_: Literal[False, True] = False,
7580
+ **request_kwargs,
7581
+ ) -> dict | Coroutine[Any, Any, dict]:
7582
+ """用户使用记录
7583
+
7584
+ GET https://www.123pan.com/api/user/use_history
7585
+
7586
+ :payload:
7587
+ - event: str = "loginRecord" 💡 事件类型,"loginRecord" 为登录记录
7588
+ """
7589
+ if not isinstance(payload, dict):
7590
+ payload = {"event": payload}
7591
+ return self.request(
7592
+ "user/use_history",
7593
+ params=payload,
7594
+ base_url=base_url,
7595
+ async_=async_,
7596
+ **request_kwargs,
7597
+ )
7598
+
7360
7599
  # TODO: 添加扫码登录接口,以及通过扫码登录的方法
7361
7600
  # TODO: 添加 同步空间 和 直链空间 的操作接口
7362
7601
  # TODO: 添加 图床 的操作接口
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "p123client"
3
- version = "0.0.6.7"
3
+ version = "0.0.6.8"
4
4
  description = "Python 123 webdisk client."
5
5
  authors = ["ChenyangGao <wosiwujm@gmail.com>"]
6
6
  license = "MIT"
File without changes
File without changes