Skip to content

Commit

Permalink
Merge branch 'devel' into pure-py
Browse files Browse the repository at this point in the history
# Conflicts:
#	ktoolbox/cli.py
#	pyproject.toml
  • Loading branch information
Ljzd-PRO committed Dec 3, 2024
2 parents a360b4c + f47c3ca commit 9a1ed16
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 23 deletions.
21 changes: 7 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
## Changes

### 💡 Feature
[//]: # (### 💡 Feature)

- The `search-creator` command will include search results with similar names.
- For example, the search parameter `--name abc` might return author information such as: `abc, abcd, hi-abc`
- Share an HTTPX client to reuse underlying TCP connections through an HTTP connection pool when calling APIs and downloading,
**significantly improving query and download speeds as well as connection stability**
### 🪲 Fix

[//]: # (### 🪲 Fix)
- Update the API for retrieving post information and fix the `get-post` and `download-post` commands (#198) (#180)

- - -
[//]: # (### 💡 新特性)

### 💡 新特性
### 🪲 修复

- search-creator 搜索作者的命令将包含那些名字相近的搜索结果
- 如搜索参数 `--name abc` 可能得到如下作者信息:`abc, abcd, hi-abc`
- 共享 HTTPX 客户端,调用 API 和下载时将通过 HTTP 连接池重用底层 TCP 连接,**显著提升查询、下载速度和连接稳定性**
- 更新获取作品信息的 API,修复 `get-post``download-post` 命令 (#198) (#180)

[//]: # (### 🪲 修复)

**Full Changelog**: https://github.com/Ljzd-PRO/KToolBox/compare/v0.10.0...v0.11.0
**Full Changelog**: https://github.com/Ljzd-PRO/KToolBox/compare/v0.11.0...v0.11.1
2 changes: 1 addition & 1 deletion ktoolbox/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__title__ = "KToolBox"
# noinspection SpellCheckingInspection
__description__ = "A useful CLI tool for downloading posts in Kemono.party / .su"
__version__ = "v0.11.0"
__version__ = "v0.11.1"
8 changes: 5 additions & 3 deletions ktoolbox/api/posts/get_post.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pydantic import BaseModel

from ktoolbox.api import BaseAPI, APIRet
from ktoolbox.api.model import Post

Expand All @@ -8,11 +10,11 @@ class GetPost(BaseAPI):
path = "/{service}/user/{creator_id}/post/{post_id}"
method = "get"

class Response(Post):
...
class Response(BaseModel):
post: Post

@classmethod
async def __call__(cls, service: str, creator_id: str, post_id: str) -> APIRet[Post]:
async def __call__(cls, service: str, creator_id: str, post_id: str) -> APIRet[Response]:
"""
Get a specific post
Expand Down
8 changes: 4 additions & 4 deletions ktoolbox/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ async def get_post(service: str, creator_id: str, post_id: str, *, dump: Path =
if dump:
async with aiofiles.open(str(dump), "w", encoding="utf-8") as f:
await f.write(
ret.data.json(indent=config.json_dump_indent)
ret.data.post.json(indent=config.json_dump_indent)
)
return ret.data
return ret.data.post
else:
return ret.message

Expand Down Expand Up @@ -187,9 +187,9 @@ async def download_post(
post_id=post_id
)
if ret:
post_path = path / generate_post_path_name(ret.data)
post_path = path / generate_post_path_name(ret.data.post)
job_list = await create_job_from_post(
post=ret.data,
post=ret.data.post,
post_path=post_path,
dump_post_data=dump_post_data
)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ktoolbox-pure-py"
version = "v0.11.0"
version = "v0.11.1"
description = "A useful CLI tool for downloading posts in Kemono.su / .party (Pure Python version)"
authors = ["Ljzd-PRO <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 9a1ed16

Please sign in to comment.