p123client 0.0.7.2__tar.gz → 0.0.7.3__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.7.2
3
+ Version: 0.0.7.3
4
4
  Summary: Python 123 webdisk client.
5
5
  Home-page: https://github.com/ChenyangGao/p123client
6
6
  License: MIT
@@ -488,7 +488,7 @@ class P123OpenClient:
488
488
  request_kwargs["session"] = self.async_session if async_ else self.session
489
489
  request_kwargs["async_"] = async_
490
490
  request = get_default_request()
491
- if self.can_relogin():
491
+ if self.check_for_relogin:
492
492
  headers = dict(self.headers)
493
493
  if request_headers := request_kwargs.get("headers"):
494
494
  headers.update(request_headers)
@@ -526,8 +526,8 @@ class P123OpenClient:
526
526
  if token != token_new:
527
527
  headers["authorization"] = "Bearer " + self.token
528
528
  continue
529
- if i:
530
- raise
529
+ if i or not self.can_relogin():
530
+ return resp
531
531
  user_id = getattr(self, "user_id", None)
532
532
  warn(f"relogin to refresh token: {user_id=}", category=P123Warning)
533
533
  yield self.login(replace=True, async_=async_)
@@ -3823,7 +3823,12 @@ class P123OpenClient:
3823
3823
  - sharePwd: str = "" 💡 设置分享链接提取码
3824
3824
  - trafficLimit: int = <default> 💡 免登陆限制流量,单位:字节
3825
3825
  - trafficLimitSwitch: 1 | 2 = <default> 💡 免登录流量限制开关:1:关闭 2:打开
3826
- - trafficSwitch: 1 | 2 = <default> 💡 免登录流量包开关:1:关闭 2:打开
3826
+ - trafficSwitch: 1 | 2 | 3 | 4 = <default> 💡 免登录流量包开关
3827
+
3828
+ - 1: 游客免登录提取(关) 超流量用户提取(关)
3829
+ - 2: 游客免登录提取(开) 超流量用户提取(关)
3830
+ - 3: 游客免登录提取(关) 超流量用户提取(开)
3831
+ - 4: 游客免登录提取(开) 超流量用户提取(开)
3827
3832
  """
3828
3833
  api = complete_url("/api/v1/share/create", base_url)
3829
3834
  payload = dict_to_lower_merge(payload, {"shareExpire": 0, "sharePwd": ""})
@@ -3926,7 +3931,12 @@ class P123OpenClient:
3926
3931
  - shareIdList: list[int] 💡 分享链接 id 列表,最多 100 个
3927
3932
  - trafficLimit: int = <default> 💡 免登陆限制流量,单位:字节
3928
3933
  - trafficLimitSwitch: 1 | 2 = <default> 💡 免登录流量限制开关:1:关闭 2:打开
3929
- - trafficSwitch: 1 | 2 = <default> 💡 免登录流量包开关:1:关闭 2:打开
3934
+ - trafficSwitch: 1 | 2 | 3 | 4 = <default> 💡 免登录流量包开关
3935
+
3936
+ - 1: 游客免登录提取(关) 超流量用户提取(关)
3937
+ - 2: 游客免登录提取(开) 超流量用户提取(关)
3938
+ - 3: 游客免登录提取(关) 超流量用户提取(开)
3939
+ - 4: 游客免登录提取(开) 超流量用户提取(开)
3930
3940
  """
3931
3941
  api = complete_url("/api/v1/share/list/info", base_url)
3932
3942
  if not isinstance(payload, dict):
@@ -6269,6 +6279,105 @@ class P123Client(P123OpenClient):
6269
6279
  **request_kwargs,
6270
6280
  )
6271
6281
 
6282
+ @overload
6283
+ def app_permission_delete(
6284
+ self,
6285
+ payload: dict | str,
6286
+ /,
6287
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
6288
+ *,
6289
+ async_: Literal[False] = False,
6290
+ **request_kwargs,
6291
+ ) -> dict:
6292
+ ...
6293
+ @overload
6294
+ def app_permission_delete(
6295
+ self,
6296
+ payload: dict | str,
6297
+ /,
6298
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
6299
+ *,
6300
+ async_: Literal[True],
6301
+ **request_kwargs,
6302
+ ) -> Coroutine[Any, Any, dict]:
6303
+ ...
6304
+ def app_permission_delete(
6305
+ self,
6306
+ payload: dict | str,
6307
+ /,
6308
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
6309
+ *,
6310
+ async_: Literal[False, True] = False,
6311
+ **request_kwargs,
6312
+ ) -> dict | Coroutine[Any, Any, dict]:
6313
+ """第三方挂载工具登录授权列表
6314
+
6315
+ DELETE https://www.123pan.com/api/restful/goapi/v1/oauth2/app_permission
6316
+
6317
+ :payload:
6318
+ - appId: str 💡 应用 id,也就是 ``client_id``
6319
+ """
6320
+ if not isinstance(payload, dict):
6321
+ payload = {"appId": payload}
6322
+ return self.request(
6323
+ "restful/goapi/v1/oauth2/app_permission",
6324
+ "DELETE",
6325
+ params=payload,
6326
+ base_url=base_url,
6327
+ async_=async_,
6328
+ **request_kwargs,
6329
+ )
6330
+
6331
+ @overload
6332
+ def app_permission_list(
6333
+ self,
6334
+ payload: dict | int = 1,
6335
+ /,
6336
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
6337
+ *,
6338
+ async_: Literal[False] = False,
6339
+ **request_kwargs,
6340
+ ) -> dict:
6341
+ ...
6342
+ @overload
6343
+ def app_permission_list(
6344
+ self,
6345
+ payload: dict | int = 1,
6346
+ /,
6347
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
6348
+ *,
6349
+ async_: Literal[True],
6350
+ **request_kwargs,
6351
+ ) -> Coroutine[Any, Any, dict]:
6352
+ ...
6353
+ def app_permission_list(
6354
+ self,
6355
+ payload: dict | int = 1,
6356
+ /,
6357
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
6358
+ *,
6359
+ async_: Literal[False, True] = False,
6360
+ **request_kwargs,
6361
+ ) -> dict | Coroutine[Any, Any, dict]:
6362
+ """第三方挂载工具登录授权列表
6363
+
6364
+ GET https://www.123pan.com/api/restful/goapi/v1/oauth2/app_permission/list
6365
+
6366
+ :payload:
6367
+ - page: int = 1 💡 第几页
6368
+ - pageSize: int = 100 💡 分页大小
6369
+ """
6370
+ if not isinstance(payload, dict):
6371
+ payload = {"page": payload}
6372
+ payload.setdefault("pageSize", 100)
6373
+ return self.request(
6374
+ "restful/goapi/v1/oauth2/app_permission/list",
6375
+ params=payload,
6376
+ base_url=base_url,
6377
+ async_=async_,
6378
+ **request_kwargs,
6379
+ )
6380
+
6272
6381
  @overload
6273
6382
  @staticmethod
6274
6383
  def app_server_time(
@@ -6797,6 +6906,180 @@ class P123Client(P123OpenClient):
6797
6906
  **request_kwargs,
6798
6907
  )
6799
6908
 
6909
+ @overload
6910
+ def fs_archive_list(
6911
+ self,
6912
+ payload: dict | int | str,
6913
+ /,
6914
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
6915
+ *,
6916
+ async_: Literal[False] = False,
6917
+ **request_kwargs,
6918
+ ) -> dict:
6919
+ ...
6920
+ @overload
6921
+ def fs_archive_list(
6922
+ self,
6923
+ payload: dict | int | str,
6924
+ /,
6925
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
6926
+ *,
6927
+ async_: Literal[True],
6928
+ **request_kwargs,
6929
+ ) -> Coroutine[Any, Any, dict]:
6930
+ ...
6931
+ def fs_archive_list(
6932
+ self,
6933
+ payload: dict | int | str,
6934
+ /,
6935
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
6936
+ *,
6937
+ async_: Literal[False, True] = False,
6938
+ **request_kwargs,
6939
+ ) -> dict | Coroutine[Any, Any, dict]:
6940
+ """推送【云解压】任务
6941
+
6942
+ GET https://www.123pan.com/api/restful/goapi/v1/archive/file/list
6943
+
6944
+ .. note::
6945
+ 后台异步执行,任务结果请从 ``client.fs_archive_status()`` 接口获取
6946
+
6947
+ :payload:
6948
+ - fileId: int | str 💡 压缩包的文件 id
6949
+ - password: int | str = "" 💡 解压密码
6950
+ """
6951
+ if not isinstance(payload, dict):
6952
+ payload = {"fileId": payload}
6953
+ return self.request(
6954
+ "restful/goapi/v1/archive/file/list",
6955
+ params=payload,
6956
+ base_url=base_url,
6957
+ async_=async_,
6958
+ **request_kwargs,
6959
+ )
6960
+
6961
+ @overload
6962
+ def fs_archive_status(
6963
+ self,
6964
+ payload: dict,
6965
+ /,
6966
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
6967
+ *,
6968
+ async_: Literal[False] = False,
6969
+ **request_kwargs,
6970
+ ) -> dict:
6971
+ ...
6972
+ @overload
6973
+ def fs_archive_status(
6974
+ self,
6975
+ payload: dict,
6976
+ /,
6977
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
6978
+ *,
6979
+ async_: Literal[True],
6980
+ **request_kwargs,
6981
+ ) -> Coroutine[Any, Any, dict]:
6982
+ ...
6983
+ def fs_archive_status(
6984
+ self,
6985
+ payload: dict,
6986
+ /,
6987
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
6988
+ *,
6989
+ async_: Literal[False, True] = False,
6990
+ **request_kwargs,
6991
+ ) -> dict | Coroutine[Any, Any, dict]:
6992
+ """推送云解压任务
6993
+
6994
+ GET https://www.123pan.com/api/restful/goapi/v1/archive/file/status
6995
+
6996
+ .. note::
6997
+ 响应结果中包含 "state" 字段,具体含义为
6998
+
6999
+ - 0: 未运行或不存在
7000
+ - 1: 运行中
7001
+ - 2: 成功
7002
+ - 3: 失败
7003
+
7004
+ :payload:
7005
+ - fileId: int | str 💡 压缩包的文件 id
7006
+ - taskId: int | str 💡 任务 id
7007
+ - taskType: int = <default> 💡 任务类型。目前已知:1:云解压 2:解压到
7008
+ """
7009
+ return self.request(
7010
+ "restful/goapi/v1/archive/file/status",
7011
+ params=payload,
7012
+ base_url=base_url,
7013
+ async_=async_,
7014
+ **request_kwargs,
7015
+ )
7016
+
7017
+ @overload
7018
+ def fs_archive_uncompress(
7019
+ self,
7020
+ payload: dict,
7021
+ /,
7022
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
7023
+ *,
7024
+ async_: Literal[False] = False,
7025
+ **request_kwargs,
7026
+ ) -> dict:
7027
+ ...
7028
+ @overload
7029
+ def fs_archive_uncompress(
7030
+ self,
7031
+ payload: dict,
7032
+ /,
7033
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
7034
+ *,
7035
+ async_: Literal[True],
7036
+ **request_kwargs,
7037
+ ) -> Coroutine[Any, Any, dict]:
7038
+ ...
7039
+ def fs_archive_uncompress(
7040
+ self,
7041
+ payload: dict,
7042
+ /,
7043
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
7044
+ *,
7045
+ async_: Literal[False, True] = False,
7046
+ **request_kwargs,
7047
+ ) -> dict | Coroutine[Any, Any, dict]:
7048
+ """推送【解压到】任务
7049
+
7050
+ POST https://www.123pan.com/api/restful/goapi/v1/archive/file/uncompress
7051
+
7052
+ :payload:
7053
+ - fileId: int | str 💡 压缩包的文件 id
7054
+ - password: int | str = "" 💡 解压密码
7055
+ - targetFileId: int | str = 0 💡 保存到的目录 id
7056
+ - taskId: int 💡 任务 id
7057
+ - list: list[FileInfo] 💡 选择要解压的文件列表,信息来自 ``client.fs_archive_status()`` 接口的响应
7058
+
7059
+ .. code:: python
7060
+
7061
+ FileInfo: {
7062
+ "fontId": str,
7063
+ "fileName": str,
7064
+ "parentFile": str,
7065
+ "filePath": str,
7066
+ "fileSize": int,
7067
+ "fileType": 0 | 1,
7068
+ "createTime": str,
7069
+ "category": int,
7070
+ "childFiles": None | list[FileInfo],
7071
+ }
7072
+ """
7073
+ payload.setdefault("targetFileId", 0)
7074
+ return self.request(
7075
+ "restful/goapi/v1/archive/file/uncompress",
7076
+ "POST",
7077
+ json=payload,
7078
+ base_url=base_url,
7079
+ async_=async_,
7080
+ **request_kwargs,
7081
+ )
7082
+
6800
7083
  @overload
6801
7084
  def fs_copy(
6802
7085
  self,
@@ -7020,6 +7303,9 @@ class P123Client(P123OpenClient):
7020
7303
 
7021
7304
  POST https://www.123pan.com/api/file/get_path
7022
7305
 
7306
+ .. note::
7307
+ 随后你可以把这组祖先节点 id 传给 ``client.fs_info()`` 接口,即可获得具体的节点信息
7308
+
7023
7309
  :payload:
7024
7310
  - fileId: int 💡 文件 id
7025
7311
  """
@@ -8153,6 +8439,145 @@ class P123Client(P123OpenClient):
8153
8439
  **request_kwargs,
8154
8440
  )
8155
8441
 
8442
+ @overload
8443
+ def fs_webdav_account_create(
8444
+ self,
8445
+ payload: dict | str,
8446
+ /,
8447
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
8448
+ *,
8449
+ async_: Literal[False] = False,
8450
+ **request_kwargs,
8451
+ ) -> dict:
8452
+ ...
8453
+ @overload
8454
+ def fs_webdav_account_create(
8455
+ self,
8456
+ payload: dict | str,
8457
+ /,
8458
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
8459
+ *,
8460
+ async_: Literal[True],
8461
+ **request_kwargs,
8462
+ ) -> Coroutine[Any, Any, dict]:
8463
+ ...
8464
+ def fs_webdav_account_create(
8465
+ self,
8466
+ payload: dict | str,
8467
+ /,
8468
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
8469
+ *,
8470
+ async_: Literal[False, True] = False,
8471
+ **request_kwargs,
8472
+ ) -> dict | Coroutine[Any, Any, dict]:
8473
+ """WebDAV 添加应用
8474
+
8475
+ POST https://www.123pan.com/api/restful/goapi/v1/webdav/account/create
8476
+
8477
+ .. caution::
8478
+ 密码不能自己设置,只会自动生成
8479
+
8480
+ :payload:
8481
+ - app: str 💡 应用名字
8482
+ """
8483
+ if not isinstance(payload, dict):
8484
+ payload = {"app": payload}
8485
+ return self.request(
8486
+ "restful/goapi/v1/webdav/account/create",
8487
+ "POST",
8488
+ json=payload,
8489
+ base_url=base_url,
8490
+ async_=async_,
8491
+ **request_kwargs,
8492
+ )
8493
+
8494
+ @overload
8495
+ def fs_webdav_account_delete(
8496
+ self,
8497
+ payload: dict | int | str,
8498
+ /,
8499
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
8500
+ *,
8501
+ async_: Literal[False] = False,
8502
+ **request_kwargs,
8503
+ ) -> dict:
8504
+ ...
8505
+ @overload
8506
+ def fs_webdav_account_delete(
8507
+ self,
8508
+ payload: dict | int | str,
8509
+ /,
8510
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
8511
+ *,
8512
+ async_: Literal[True],
8513
+ **request_kwargs,
8514
+ ) -> Coroutine[Any, Any, dict]:
8515
+ ...
8516
+ def fs_webdav_account_delete(
8517
+ self,
8518
+ payload: dict | int | str,
8519
+ /,
8520
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
8521
+ *,
8522
+ async_: Literal[False, True] = False,
8523
+ **request_kwargs,
8524
+ ) -> dict | Coroutine[Any, Any, dict]:
8525
+ """WebDAV 删除应用(解除授权)
8526
+
8527
+ GET https://www.123pan.com/api/restful/goapi/v1/webdav/account/del
8528
+
8529
+ :payload:
8530
+ - id: int | str 💡 应用 id
8531
+ """
8532
+ if not isinstance(payload, dict):
8533
+ payload = {"id": payload}
8534
+ return self.request(
8535
+ "restful/goapi/v1/webdav/account/del",
8536
+ params=payload,
8537
+ base_url=base_url,
8538
+ async_=async_,
8539
+ **request_kwargs,
8540
+ )
8541
+
8542
+ @overload
8543
+ def fs_webdav_account_list(
8544
+ self,
8545
+ /,
8546
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
8547
+ *,
8548
+ async_: Literal[False] = False,
8549
+ **request_kwargs,
8550
+ ) -> dict:
8551
+ ...
8552
+ @overload
8553
+ def fs_webdav_account_list(
8554
+ self,
8555
+ /,
8556
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
8557
+ *,
8558
+ async_: Literal[True],
8559
+ **request_kwargs,
8560
+ ) -> Coroutine[Any, Any, dict]:
8561
+ ...
8562
+ def fs_webdav_account_list(
8563
+ self,
8564
+ /,
8565
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
8566
+ *,
8567
+ async_: Literal[False, True] = False,
8568
+ **request_kwargs,
8569
+ ) -> dict | Coroutine[Any, Any, dict]:
8570
+ """WebDAV 授权列表
8571
+
8572
+ GET https://www.123pan.com/api/restful/goapi/v1/webdav/account/list
8573
+ """
8574
+ return self.request(
8575
+ "restful/goapi/v1/webdav/account/list",
8576
+ base_url=base_url,
8577
+ async_=async_,
8578
+ **request_kwargs,
8579
+ )
8580
+
8156
8581
  ########## Qrcode API ##########
8157
8582
 
8158
8583
  @overload
@@ -9096,6 +9521,63 @@ class P123Client(P123OpenClient):
9096
9521
  **request_kwargs,
9097
9522
  )
9098
9523
 
9524
+ @overload
9525
+ def share_commission_set(
9526
+ self,
9527
+ payload: dict | int | str | Iterable[int | str],
9528
+ /,
9529
+ amount: int = 0,
9530
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
9531
+ *,
9532
+ async_: Literal[False] = False,
9533
+ **request_kwargs,
9534
+ ) -> dict:
9535
+ ...
9536
+ @overload
9537
+ def share_commission_set(
9538
+ self,
9539
+ payload: dict | int | str | Iterable[int | str],
9540
+ /,
9541
+ amount: int = 0,
9542
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
9543
+ *,
9544
+ async_: Literal[True],
9545
+ **request_kwargs,
9546
+ ) -> Coroutine[Any, Any, dict]:
9547
+ ...
9548
+ def share_commission_set(
9549
+ self,
9550
+ payload: dict | int | str | Iterable[int | str],
9551
+ /,
9552
+ amount: int = 0,
9553
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
9554
+ *,
9555
+ async_: Literal[False, True] = False,
9556
+ **request_kwargs,
9557
+ ) -> dict | Coroutine[Any, Any, dict]:
9558
+ """分佣设置
9559
+
9560
+ POST https://www.123pan.com/api/share/update
9561
+
9562
+ :payload:
9563
+ - shareIds: int | str 💡 分享 id,多个用 "," 隔开
9564
+ - noLoginStdAmount: int = 0 💡 文件体积单价(如果为 0 则是关闭),单位:1 分钱
9565
+ """
9566
+ if isinstance(payload, (int, str)):
9567
+ payload = {"shareIds": payload}
9568
+ elif not isinstance(payload, dict):
9569
+ payload = {"ids": ",".join(map(str, payload))}
9570
+ payload = cast(dict, payload)
9571
+ payload.setdefault("noLoginStdAmount", amount)
9572
+ return self.request(
9573
+ "share/update",
9574
+ "POST",
9575
+ json=payload,
9576
+ base_url=base_url,
9577
+ async_=async_,
9578
+ **request_kwargs,
9579
+ )
9580
+
9099
9581
  @overload
9100
9582
  def share_create(
9101
9583
  self,
@@ -9137,16 +9619,24 @@ class P123Client(P123OpenClient):
9137
9619
  - driveId: int = 0
9138
9620
  - event: str = "shareCreate" 💡 事件类型
9139
9621
  - expiration: "9999-12-31T23:59:59+08:00" 💡 有效期,日期用 ISO 格式
9622
+ - fileNum: int = <default> 💡 文件数
9623
+ - fillPwdSwitch: 0 | 1 = 1 💡 是否自动填充提取码
9140
9624
  - isPayShare: bool = False 💡 是否付费分享
9141
9625
  - isReward: 0 | 1 = 0 💡 是否开启打赏
9142
9626
  - payAmount: int = 0 💡 付费金额,单位:分
9143
9627
  - renameVisible: bool = False
9144
9628
  - resourceDesc: str = "" 💡 资源描述
9629
+ - shareModality: int = <default>
9145
9630
  - shareName: str = <default> 💡 分享名称
9146
9631
  - sharePwd: str = "" 💡 分享密码
9147
9632
  - trafficLimit: int = 0 💡 流量限制额度,单位字节
9148
9633
  - trafficLimitSwitch: 1 | 2 = 1 💡 是否开启流量限制:1:关闭 2:开启
9149
- - trafficSwitch: 1 | 2 = 1 💡 是否开启免登录流量包:1:关闭 2:开启
9634
+ - trafficSwitch: 1 | 2 | 3 | 4 = <default> 💡 免登录流量包开关
9635
+
9636
+ - 1: 游客免登录提取(关) 超流量用户提取(关)
9637
+ - 2: 游客免登录提取(开) 超流量用户提取(关)
9638
+ - 3: 游客免登录提取(关) 超流量用户提取(开)
9639
+ - 4: 游客免登录提取(开) 超流量用户提取(开)
9150
9640
  """
9151
9641
  if isinstance(payload, (int, str)):
9152
9642
  payload = {"fileIdList": payload}
@@ -9157,6 +9647,7 @@ class P123Client(P123OpenClient):
9157
9647
  "driveId": 0,
9158
9648
  "event": "shareCreate",
9159
9649
  "expiration": "9999-12-31T23:59:59+08:00",
9650
+ "fillPwdSwitch": 1,
9160
9651
  "isPayShare": False,
9161
9652
  "isReward": 0,
9162
9653
  "payAmount": 0,
@@ -9693,7 +10184,7 @@ class P123Client(P123OpenClient):
9693
10184
 
9694
10185
  :payload:
9695
10186
  - ids: list[int | str] 💡 分享 id
9696
- - isReward: 0 | 1 = 1
10187
+ - isReward: 0 | 1 = 1 💡 是否开启打赏
9697
10188
  """
9698
10189
  if isinstance(payload, (int, str)):
9699
10190
  payload = {"ids": [payload]}
@@ -9709,6 +10200,45 @@ class P123Client(P123OpenClient):
9709
10200
  **request_kwargs,
9710
10201
  )
9711
10202
 
10203
+ @overload
10204
+ def share_traffic(
10205
+ self,
10206
+ /,
10207
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
10208
+ *,
10209
+ async_: Literal[False] = False,
10210
+ **request_kwargs,
10211
+ ) -> dict:
10212
+ ...
10213
+ @overload
10214
+ def share_traffic(
10215
+ self,
10216
+ /,
10217
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
10218
+ *,
10219
+ async_: Literal[True],
10220
+ **request_kwargs,
10221
+ ) -> Coroutine[Any, Any, dict]:
10222
+ ...
10223
+ def share_traffic(
10224
+ self,
10225
+ /,
10226
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
10227
+ *,
10228
+ async_: Literal[False, True] = False,
10229
+ **request_kwargs,
10230
+ ) -> dict | Coroutine[Any, Any, dict]:
10231
+ """分享提取流量包的信息
10232
+
10233
+ GET https://www.123pan.com/api/share/traffic-info
10234
+ """
10235
+ return self.request(
10236
+ "share/traffic-info",
10237
+ base_url=base_url,
10238
+ async_=async_,
10239
+ **request_kwargs,
10240
+ )
10241
+
9712
10242
  @overload
9713
10243
  def share_traffic_set(
9714
10244
  self,
@@ -9748,8 +10278,12 @@ class P123Client(P123OpenClient):
9748
10278
  - shareId: int | str
9749
10279
  - trafficLimit: int = <default> 💡 流量限制额度,单位字节
9750
10280
  - trafficLimitSwitch: 1 | 2 = <default> 💡 是否开启流量限制:1:关闭 2:开启
9751
- - trafficSwitch: 1 | 2 = <default> 💡 是否开启免登录流量包:1:关闭 2:开启
9752
- - ...
10281
+ - trafficSwitch: 1 | 2 | 3 | 4 = <default> 💡 免登录流量包开关
10282
+
10283
+ - 1: 游客免登录提取(关) 超流量用户提取(关)
10284
+ - 2: 游客免登录提取(开) 超流量用户提取(关)
10285
+ - 3: 游客免登录提取(关) 超流量用户提取(开)
10286
+ - 4: 游客免登录提取(开) 超流量用户提取(开)
9753
10287
  """
9754
10288
  return self.request(
9755
10289
  "restful/goapi/v1/share/info",
@@ -10575,6 +11109,58 @@ class P123Client(P123OpenClient):
10575
11109
  **request_kwargs,
10576
11110
  )
10577
11111
 
11112
+ @overload
11113
+ def user_modify_info(
11114
+ self,
11115
+ payload: dict | str,
11116
+ /,
11117
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
11118
+ *,
11119
+ async_: Literal[False] = False,
11120
+ **request_kwargs,
11121
+ ) -> dict:
11122
+ ...
11123
+ @overload
11124
+ def user_modify_info(
11125
+ self,
11126
+ payload: dict | str,
11127
+ /,
11128
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
11129
+ *,
11130
+ async_: Literal[True],
11131
+ **request_kwargs,
11132
+ ) -> Coroutine[Any, Any, dict]:
11133
+ ...
11134
+ def user_modify_info(
11135
+ self,
11136
+ payload: dict | str,
11137
+ /,
11138
+ base_url: str | Callable[[], str] = DEFAULT_BASE_URL,
11139
+ *,
11140
+ async_: Literal[False, True] = False,
11141
+ **request_kwargs,
11142
+ ) -> dict | Coroutine[Any, Any, dict]:
11143
+ """修改用户信息,默认行为是 修改用户昵称
11144
+
11145
+ POST https://www.123pan.com/api/user/modify_info
11146
+
11147
+ :payload:
11148
+ - event: str 💡 事件类型
11149
+ - nickname: str = <default> 💡 用户昵称
11150
+ - operateType: int = <default>
11151
+ - ...
11152
+ """
11153
+ if not isinstance(payload, dict):
11154
+ payload = {"nickname": payload, "event": "userDataOperate", "operateType": 2}
11155
+ return self.request(
11156
+ "user/modify_info",
11157
+ "POST",
11158
+ json=payload,
11159
+ base_url=base_url,
11160
+ async_=async_,
11161
+ **request_kwargs,
11162
+ )
11163
+
10578
11164
  @overload
10579
11165
  def user_referral_info(
10580
11166
  self,
@@ -10603,7 +11189,7 @@ class P123Client(P123OpenClient):
10603
11189
  async_: Literal[False, True] = False,
10604
11190
  **request_kwargs,
10605
11191
  ) -> dict | Coroutine[Any, Any, dict]:
10606
- """用户拉人头信息
11192
+ """用户拉新返佣信息
10607
11193
 
10608
11194
  GET https://www.123pan.com/api/referral/my-info
10609
11195
  """
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "p123client"
3
- version = "0.0.7.2"
3
+ version = "0.0.7.3"
4
4
  description = "Python 123 webdisk client."
5
5
  authors = ["ChenyangGao <wosiwujm@gmail.com>"]
6
6
  license = "MIT"
File without changes
File without changes