toot timeline chokes on last_status_at field
illdefined opened this issue · comments
When retrieving the timeline from an Akkoma instance (tried it with Akkoma 3.9.3, 3.10.3 and 3.10.4), toot timeline
(version 0.38.1) chokes on the last_status_at
account field:
Traceback (most recent call last):
File "/nix/store/85x1fp77svwvdmbnfpzvn63qpg0vlzbj-toot-0.38.1/bin/.toot-wrapped", line 9, in <module>
sys.exit(main())
File "/nix/store/85x1fp77svwvdmbnfpzvn63qpg0vlzbj-toot-0.38.1/lib/python3.10/site-packages/toot/console.py", line 961, in main
run_command(app, user, command_name, args)
File "/nix/store/85x1fp77svwvdmbnfpzvn63qpg0vlzbj-toot-0.38.1/lib/python3.10/site-packages/toot/console.py", line 943, in run_command
return fn(app, user, parsed_args)
File "/nix/store/85x1fp77svwvdmbnfpzvn63qpg0vlzbj-toot-0.38.1/lib/python3.10/site-packages/toot/commands.py", line 60, in timeline
statuses = [from_dict(Status, item) for item in items]
File "/nix/store/85x1fp77svwvdmbnfpzvn63qpg0vlzbj-toot-0.38.1/lib/python3.10/site-packages/toot/commands.py", line 60, in <listcomp>
statuses = [from_dict(Status, item) for item in items]
File "/nix/store/85x1fp77svwvdmbnfpzvn63qpg0vlzbj-toot-0.38.1/lib/python3.10/site-packages/toot/entities.py", line 373, in from_dict
return cls(**dict(_fields()))
File "/nix/store/85x1fp77svwvdmbnfpzvn63qpg0vlzbj-toot-0.38.1/lib/python3.10/site-packages/toot/entities.py", line 371, in _fields
yield field.name, _convert(field_type, value)
File "/nix/store/85x1fp77svwvdmbnfpzvn63qpg0vlzbj-toot-0.38.1/lib/python3.10/site-packages/toot/entities.py", line 404, in _convert
return from_dict(field_type, value)
File "/nix/store/85x1fp77svwvdmbnfpzvn63qpg0vlzbj-toot-0.38.1/lib/python3.10/site-packages/toot/entities.py", line 373, in from_dict
return cls(**dict(_fields()))
File "/nix/store/85x1fp77svwvdmbnfpzvn63qpg0vlzbj-toot-0.38.1/lib/python3.10/site-packages/toot/entities.py", line 371, in _fields
yield field.name, _convert(field_type, value)
File "/nix/store/85x1fp77svwvdmbnfpzvn63qpg0vlzbj-toot-0.38.1/lib/python3.10/site-packages/toot/entities.py", line 397, in _convert
return date.fromisoformat(value)
ValueError: Invalid isoformat string: '2023-08-29T13:13:57'
toot expects a date (cf. https://github.com/ihabunek/toot/blob/master/toot/entities.py#L64), but Akkoma provides a date/time without timezone (like 2023-08-30T11:40:00
).
Mastodon appears to provide a full date/time with decimal fraction and timezone (like 2023-08-30T11:40:00.000Z
) according to documentation, which would as far as I see also break toot: https://docs.joinmastodon.org/methods/statuses/
Corresponding Akkoma issue: https://akkoma.dev/AkkomaGang/akkoma/issues/637
Per my comment on the Akkoma repo, the Masto example is wrong according to their own docs - Status
includes Account
which has last_status_at
defined to be ISO8601 DateTime or null. toot
is correct here, I think, and Akkoma is sending the wrong format.
Checked using a couple of links on octodon.social and mastodon.social - both are sending YYYY-MM-DD as expected.
Per my comment on the Akkoma repo, the Masto example is wrong according to their own docs -
Status
includesAccount
which haslast_status_at
defined to be ISO8601 DateTime or null.toot
is correct here, I think, and Akkoma is sending the wrong format.Checked using a couple of links on octodon.social and mastodon.social - both are sending YYYY-MM-DD as expected.
Thank you for looking into this.
I opened an issue regarding the documentation inconsistency: mastodon/mastodon#26843
Thanks for this report; regardless of the correctness or incorrectness of Mastodon, toot should not be crashing.
Fixed by PR #405
Thanks for fixing this quickly <3
Do you think you could cut out a new release containing this fix? 0.38.1 can't really be used with Akkoma/Pleroma as it is :(
Thanks for fixing this quickly <3
Do you think you could cut out a new release containing this fix? 0.38.1 can't really be used with Akkoma/Pleroma as it is :(
Unfortunately I cannot. @ihabunek is the one to ask.
@picnoir I pushed v 0.38.2 which includes this fix.
Thank you!