8000 Fix lint checks by upbit · Pull Request #339 · upbit/pixivpy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix lint checks #339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 3, 2024
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: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

_Pixiv API for Python (with Auth supported)_

- [2024/03/03] _v3.7.5_ Fix `novel_text()` BUG, add `webview_novel()`, see [#337](https://github.com/upbit/pixivpy/issues/337) (thanks
- [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))
- [2023/09/18] _v3.7.3_ Add `novel_follow()`, fix ByPassSniApi() host BUG, see
[#279](https://github.com/upbit/pixivpy/issues/279) (thanks
Expand Down
4 changes: 2 additions & 2 deletions pixivpy3/aapi.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

import re
import urllib.parse as up
from typing import Any
import re

try:
# Python>=3.8
Expand Down Expand Up @@ -815,7 +815,7 @@ def webview_novel(self, novel_id: int | str, raw: bool = False, req_auth: bool =
return r.text
try:
# extract JSON content
json_str = re.search(r"novel:\s({.+}),\s+isOwnWork", r.text).groups()[0].encode()
json_str = re.search(r"novel:\s({.+}),\s+isOwnWork", r.text).groups()[0].encode() # type: ignore
return self.parse_json(json_str)
except Exception as e:
raise PixivError("Extract novel content error: %s" % e, header=r.headers, body=r.text)
Expand Down
2 changes: 1 addition & 1 deletion pixivpy3/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def set_accept_language(self, language: str) -> None:
self.additional_headers["Accept-Language"] = language

@classmethod
def parse_json(cls, json_str: str) -> ParsedJson:
def parse_json(cls, json_str: str | bytes) -> ParsedJson:
"""parse str into JsonDict"""
return json.loads(json_str, object_hook=JsonDict)

Expand Down
0