Skip to content

Commit

Permalink
Fix lint checks
Browse files Browse the repository at this point in the history
  • Loading branch information
upbit committed Mar 3, 2024
1 parent 61fa19b commit 27f5847
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
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
4 changes: 2 additions & 2 deletions pixivpy3/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os
import shutil
from datetime import datetime
from typing import IO, Any
from typing import IO, Any, Union

import cloudscraper # type: ignore[import]
from requests.structures import CaseInsensitiveDict
Expand Down 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: Union[str, bytes, Any]) -> ParsedJson:
"""parse str into JsonDict"""
return json.loads(json_str, object_hook=JsonDict)

Expand Down

0 comments on commit 27f5847

Please sign in to comment.