Skip to content
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

fix: datetime.utcnow() deprecation warning #348

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nautics889
Copy link
Contributor

Taken measures according to warning: https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow
Does not affect any logic and behavior.


  • (fix): precaution of .utcnow() is deprecated

* (fix): precaution of `.utcnow()` is deprecated
@nautics889
Copy link
Contributor Author

nautics889 commented Apr 7, 2024

It seems that check failures above are not caused by this commit itself.

Logs from build 3.12
return self.parse_json(res.text)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/pixivpy/pixivpy/pixivpy3/api.py", line 49, in parse_json
    return json.loads(json_str, object_hook=JsonDict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/json/__init__.py", line 359, in loads
>>> 海沿いの街, origin url: https://i.pximg.net/c/600x1200_90/img-master/img/20[16](https://github.com/upbit/pixivpy/actions/runs/8583558571/job/23522908464?pr=348#step:7:17)/10/22/10/11/37/59580629_p0_master1200.jpg
    return cls(**kw).decode(s)
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/work/pixivpy/pixivpy/demo.py", line 343, in <module>
    main()
  File "/home/runner/work/pixivpy/pixivpy/demo.py", line 330, in main
    appapi_illust(aapi)
  File "/home/runner/work/pixivpy/pixivpy/demo.py", line 34, in appapi_illust
    json_result = aapi.illust_comments(59580629)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/pixivpy/pixivpy/pixivpy3/aapi.py", line [28](https://github.com/upbit/pixivpy/actions/runs/8583558571/job/23522908464?pr=348#step:7:29)8, in illust_comments
    return self.parse_result(r)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/pixivpy/pixivpy/pixivpy3/aapi.py", line 98, in parse_result
    raise PixivError("parse_json() error: %s" % e, header=res.headers, body=res.text)
pixivpy3.utils.PixivError: parse_json() error: Expecting value: line 1 column 1 (char 0)
Error: Process completed with exit code 1.

And that pixivpy3.utils.PixivError: parse_json() error happens because here in illust_comments() it goes down with 404 Response for request to the endpoint app-api.pixiv.net/v1/illust/comments.

And the same happens when switch to latest release of PixivPy (3.7.5), so I bet it's unrelated to changes in this commit.


I've created a separate issue for that: #349
I guess it'd be good to hold this PR for a while, before solving that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant