AmauryCarrade / MastodonToTwitter

Mastodon <-> Twitter cross-poster.
MIT License
250 stars 41 forks source link

Crashing on mastodon.Mastodon.MastodonAPIError: General API problem. #13

Closed maximeborges closed 1 year ago

maximeborges commented 7 years ago

I don't think I'm alone getting lot of errors on mastodon.social, and MastodonToTwitter seems to immediatly crash on the first error. Maybe we should add a queue to handle that ?

Traceback (most recent call last):
  File "MastodonToTwitter.py", line 212, in <module>
    new_toots = mastodon_api.account_statuses(ma_account_id, since_id = since_toot_id)
  File "/usr/local/lib/python3.4/dist-packages/mastodon/Mastodon.py", line 280, in account_statuses
    return self.__api_request('GET', '/api/v1/accounts/' + str(id) + '/statuses', params)
  File "/usr/local/lib/python3.4/dist-packages/mastodon/Mastodon.py", line 563, in __api_request
    raise MastodonAPIError('General API problem.')
mastodon.Mastodon.MastodonAPIError: General API problem.
halcy commented 7 years ago

It SHOULD yell loudly, but continue running... Is it actially stopping for you, or just complaining and continuing on?

maximeborges commented 7 years ago

I'm executing the python script in a screen with python3 MastodonToTwitter.py, and yes it's stopping on error

halcy commented 7 years ago

That's weird and shouldn't happen. I'll have to look into it.

Spaxe commented 7 years ago

I bumped into this problem just now ... we need better logging :)

tybritten commented 7 years ago

Same here. If either API craps out it doesn't just raise the error and continue, it dies.

fhemberger commented 7 years ago

Same issue here (though in different lines):

2017-04-08 16:27:08.918414500 Tweeting any toots after toot <redacted>
2017-04-08 16:27:08.918416500 Tooting any tweets after tweet <redacted>
2017-04-08 16:27:08.918416500 Updated expected short URL length: Is now 24
2017-04-08 16:27:08.920519500 Traceback (most recent call last):
2017-04-08 16:27:08.920520500   File "/home/aogami/apps/MastodonToTwitter/MastodonToTwitter.py", line 243, in <module>
2017-04-08 16:27:08.920521500     new_toots = mastodon_api.account_statuses(ma_account_id, since_id = since_toot_id)
2017-04-08 16:27:08.920521500   File "/home/aogami/.local/lib/python3.4/site-packages/mastodon/Mastodon.py", line 298, in account_statuses
2017-04-08 16:27:08.920522500     return self.__api_request('GET', '/api/v1/accounts/' + str(id) + '/statuses', params)
2017-04-08 16:27:08.920533500   File "/home/aogami/.local/lib/python3.4/site-packages/mastodon/Mastodon.py", line 670, in __api_request
2017-04-08 16:27:08.920534500     raise MastodonAPIError('General API problem.')
2017-04-08 16:27:08.920534500 mastodon.Mastodon.MastodonAPIError: General API problem.
2017-04-08 16:27:09.686307500 Traceback (most recent call last):
2017-04-08 16:27:09.686309500   File "/home/aogami/apps/MastodonToTwitter/MastodonToTwitter.py", line 220, in <module>
2017-04-08 16:27:09.686309500     ma_account_id = mastodon_api.account_verify_credentials()["id"]
2017-04-08 16:27:09.686310500   File "/home/aogami/.local/lib/python3.4/site-packages/mastodon/Mastodon.py", line 289, in account_verify_credentials
2017-04-08 16:27:09.686311500     return self.__api_request('GET', '/api/v1/accounts/verify_credentials')
2017-04-08 16:27:09.686329500   File "/home/aogami/.local/lib/python3.4/site-packages/mastodon/Mastodon.py", line 670, in __api_request
2017-04-08 16:27:09.686330500     raise MastodonAPIError('General API problem.')
2017-04-08 16:27:09.686331500 mastodon.Mastodon.MastodonAPIError: General API problem.

Had a bunch of toots posted again to my Twitter timeline.

EDIT: The script just re-sent every toot to Twitter again. The other way round seems fine.