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

toot timeline chokes on last_status_at field #399

Closed
illdefined opened this issue Aug 30, 2023 · 9 comments
Closed

toot timeline chokes on last_status_at field #399

illdefined opened this issue Aug 30, 2023 · 9 comments

Comments

@illdefined
Copy link

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/

@illdefined
Copy link
Author

Corresponding Akkoma issue: https://akkoma.dev/AkkomaGang/akkoma/issues/637

@rjp
Copy link

rjp commented Sep 7, 2023

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.

@illdefined
Copy link
Author

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.

Thank you for looking into this.

I opened an issue regarding the documentation inconsistency: mastodon/mastodon#26843

@danschwarz
Copy link
Collaborator

Thanks for this report; regardless of the correctness or incorrectness of Mastodon, toot should not be crashing.

@danschwarz
Copy link
Collaborator

Fixed by PR #405

@picnoir
Copy link

picnoir commented Nov 12, 2023

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 :(

@danschwarz
Copy link
Collaborator

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.

@ihabunek
Copy link
Owner

@picnoir I pushed v 0.38.2 which includes this fix.

@picnoir
Copy link

picnoir commented Nov 16, 2023

Thank you!

picnoir added a commit to picnoir/nixpkgs that referenced this issue Nov 16, 2023
Upstream released 0.38.2. This new release contains the pleroma fix we
previously were getting from master.

We don't need this override anymore to get the test to succeed.

ihabunek/toot#399 (comment)
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

No branches or pull requests

5 participants