Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ MANIFEST
.pytest_cache/
.mypy_cache/
.ruff_cache/

# users
.env
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

_Pixiv API for Python (with Auth supported)_

- [2025/02/09] Add `pydantic` models for App-API (thanks
[@Danipulok](https://github.com/Danipulok))
- [2024/03/03] _v3.7.5_ Fix `novel_text()` BUG, add `webview_novel()`, see
[#337](https://github.com/upbit/pixivpy/issues/337) (thanks
[@xiyihan](https://github.com/xiyihan0))
Expand Down
6 changes: 1 addition & 5 deletions pixivpy3/aapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@
"",
]
_SEARCH_TARGET: TypeAlias = Literal[
"partial_match_for_tags",
"exact_match_for_tags",
"title_and_caption",
"keyword",
"",
"partial_match_for_tags", "exact_match_for_tags", "title_and_caption", "keyword", ""
]
_SORT: TypeAlias = Literal["date_desc", "date_asc", "popular_desc", ""]
_DURATION: TypeAlias = Literal[
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pixivpy3"
version = "3.12.3"
version = "3.13.0"
description = "Pixiv API for Python (with 6.x AppAPI supported)"
authors = ["upbit <rmusique@gmail.com>"]
license = "Unlicense"
Expand All @@ -25,7 +25,7 @@ requests = "^2.31.0"
requests-toolbelt = "^1.0.0"
urllib3 = "^2.0.7"
typing-extensions = "^4.1.1"
pydantic = "^1.9.0"
pydantic = ">=1.9.0 <3.0.0"

[tool.poetry.group.dev.dependencies]
black = [
Expand Down
6 changes: 6 additions & 0 deletions tests/check_pydantic2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Check pydantic 2.x compatibility

```sh
$ pip3 install -r requirements.txt
$ python3 run check.py
```
11 changes: 11 additions & 0 deletions tests/check_pydantic2/check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import pydantic
from pixivpy3 import AppPixivAPI

print(f"Current pydantic=={pydantic.__version__}")
_PYDANTIC_MAJOR_VERSION = int(pydantic.__version__.split(".")[0])
assert _PYDANTIC_MAJOR_VERSION >= 2

api = AppPixivAPI()
assert api is not None

print("SUCCESS!")
1 change: 1 addition & 0 deletions tests/check_pydantic2/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pydantic>=2.0
14 changes: 1 addition & 13 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,7 @@

import pytest

from tests.utils import load_data_from_file, load_json_from_file


class ResponseFixture:
def __init__(
self,
status_code: int,
headers: dict[str, str] | None = None,
json_data: dict[str, Any] | None = None,
) -> None:
self.status_code = status_code
self.headers = headers or {}
self.json = json_data or {}
from tests.utils import ResponseFixture, load_data_from_file, load_json_from_file


@pytest.fixture
Expand Down
Loading