life

115 生活事件

这个模块提供了一些和 115 生活操作事件有关的函数

p115client.tool.life.BEHAVIOR_NAME_TO_TYPE: Final = {'browse_audio': 9, 'browse_document': 10, 'browse_image': 7, 'browse_video': 8, 'copy_file': 23, 'copy_folder': 18, 'delete_file': 22, 'file_rename': 24, 'folder_label': 19, 'folder_rename': 20, 'move_file': 6, 'move_image_file': 5, 'new_folder': 17, 'receive_files': 14, 'star_file': 4, 'star_image': 3, 'upload_file': 2, 'upload_image_file': 1}

115 生活操作事件名称到类型的映射

p115client.tool.life.BEHAVIOR_TYPE_TO_NAME: Final = {1: 'upload_image_file', 2: 'upload_file', 3: 'star_image', 4: 'star_file', 5: 'move_image_file', 6: 'move_file', 7: 'browse_image', 8: 'browse_video', 9: 'browse_audio', 10: 'browse_document', 14: 'receive_files', 17: 'new_folder', 18: 'copy_folder', 19: 'folder_label', 20: 'folder_rename', 22: 'delete_file', 23: 'copy_file', 24: 'file_rename'}

115 生活操作事件类型到名称的映射

p115client.tool.life.iter_life_behavior(client: str | PathLike | P115Client, from_id: int = 0, from_time: float = 0, type: str = '', ignore_types: None | Container[int] = IGNORE_BEHAVIOR_TYPES, app: str = 'web', cooldown: float = 0, interval: int | float = 0, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.life.iter_life_behavior(client: str | PathLike | P115Client, from_id: int = 0, from_time: float = 0, type: str = '', ignore_types: None | Container[int] = IGNORE_BEHAVIOR_TYPES, app: str = 'web', cooldown: float = 0, interval: int | float = 0, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

持续拉取 115 生活操作事件

Note

当你指定有 from_id != 0 时,如果 from_time 为 0,则自动重设为 -1

Caution

115 并没有收集 复制文件 和 文件改名 的事件,以及第三方上传可能会没有 上传事件 (“upload_image_file” 和 “upload_file”)

也没有从回收站的还原文件或目录的事件,但是只要你还原了,以前相应的删除事件就会消失

Parameters:
  • client – 115 客户端或 cookies

  • from_id – 开始的事件 id (不含)

  • from_time – 开始时间(含),若为 0 则从当前时间开始,若 < 0 则从最早开始

  • type – 指定拉取的操作事件名称

  • ignore_types – 一组要被忽略的操作事件类型代码,仅当 type 为空时生效

  • cooldown – 冷却时间,大于 0 时,两次接口调用之间至少间隔这么多秒

  • interval – 两个批量拉取之间的睡眠时间间隔,如果小于等于 0,则不睡眠

  • app – 使用某个 app (设备)的接口

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,产生 115 生活操作事件日志数据字典

p115client.tool.life.iter_life_behavior_list(client: str | PathLike | P115Client, from_id: int = 0, from_time: float = 0, type: str = '', ignore_types: None | Container[int] = IGNORE_BEHAVIOR_TYPES, app: str = 'web', cooldown: float = 0, *, async_: Literal[False] = False, **request_kwargs) Iterator[list[dict]][source]
p115client.tool.life.iter_life_behavior_list(client: str | PathLike | P115Client, from_id: int = 0, from_time: float = 0, type: str = '', ignore_types: None | Container[int] = IGNORE_BEHAVIOR_TYPES, app: str = 'web', cooldown: float = 0, *, async_: Literal[True], **request_kwargs) AsyncIterator[list[dict]]

持续拉取 115 生活操作事件列表

Note

当你指定有 from_id != 0 时,如果 from_time 为 0,则自动重设为 -1

Caution

115 并没有收集 复制文件 和 文件改名 的事件,以及第三方上传可能会没有 上传事件 (“upload_image_file” 和 “upload_file”)

也没有从回收站的还原文件或目录的事件,但是只要你还原了,以前相应的删除事件就会消失

Parameters:
  • client – 115 客户端或 cookies

  • from_id – 开始的事件 id (不含)

  • from_time – 开始时间(含),若为 0 则从当前时间开始,若 < 0 则从最早开始

  • type – 指定拉取的操作事件名称

  • ignore_types – 一组要被忽略的操作事件类型代码,仅当 type 为空时生效

  • app – 使用某个 app (设备)的接口

  • cooldown – 冷却时间,大于 0 时,两次接口调用之间至少间隔这么多秒

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,产生 115 生活操作事件日志数据字典

p115client.tool.life.iter_life_behavior_once(client: str | PathLike | P115Client, from_id: int = 0, from_time: float = 0, type: str = '', ignore_types: None | Container[int] = IGNORE_BEHAVIOR_TYPES, date: str = '', first_batch_size=0, app: str = 'web', cooldown: float = 0, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.life.iter_life_behavior_once(client: str | PathLike | P115Client, from_id: int = 0, from_time: float = 0, type: str = '', ignore_types: None | Container[int] = IGNORE_BEHAVIOR_TYPES, date: str = '', first_batch_size=0, app: str = 'web', cooldown: float = 0, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

拉取一组 115 生活操作事件

Note

当你指定有 from_id != 0 时,如果 from_time 为 0,则自动重设为 -1

Caution

115 并没有收集 复制文件 和 文件改名 的事件,以及第三方上传可能会没有 上传事件 (“upload_image_file” 和 “upload_file”)

也没有从回收站的还原文件或目录的事件,但是只要你还原了,以前相应的删除事件就会消失

Parameters:
  • client – 115 客户端或 cookies

  • from_id – 开始的事件 id (不含)

  • from_time – 开始时间(含),若为 0 则从当前时间开始,若 < 0 则从最早开始

  • type – 指定拉取的操作事件名称,若不指定则是全部

  • ignore_types – 一组要被忽略的操作事件类型代码,仅当 type 为空时生效

  • date – 日期,格式为 YYYY-MM-DD,若指定则只拉取这一天的数据

  • first_batch_size – 首批的拉取数目

  • app – 使用某个 app (设备)的接口

  • cooldown – 冷却时间,大于 0 时,两次接口调用之间至少间隔这么多秒

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,产生 115 生活操作事件日志数据字典

p115client.tool.life.iter_life_list(client: str | PathLike | P115Client, start_time: int | float = 0, app: str = 'web', *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.life.iter_life_list(client: str | PathLike | P115Client, start_time: int | float = 0, app: str = 'web', *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

持续拉取 115 生活操作事件列表

Caution

115 并没有收集 复制文件 和 文件改名 的事件,以及第三方上传可能会没有 上传事件 (“upload_image_file” 和 “upload_file”)

也没有从回收站的还原文件或目录的事件,但是只要你还原了,以前相应的删除事件就会消失

Parameters:
  • client – 115 客户端或 cookies

  • start_time – 开始时间(不含),若为 0 则从上 1 秒开始

  • app – 使用某个 app (设备)的接口

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,产生 115 生活操作事件日志数据字典

p115client.tool.life.life_show(client: str | PathLike | P115Client, *, async_: Literal[False] = False, **request_kwargs) dict[source]
p115client.tool.life.life_show(client: str | PathLike | P115Client, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

确保 115 生活的事件列表为开启状态

Parameters:
  • client – 115 客户端或 cookies

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

接口返回值