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

Incompability with Misskey v13.5.6+ #125

Open
ooozerooo opened this issue Mar 10, 2023 · 3 comments
Open

Incompability with Misskey v13.5.6+ #125

ooozerooo opened this issue Mar 10, 2023 · 3 comments

Comments

@ooozerooo
Copy link

Possibly due to recent changes in Misskey's API, it appears that the bot does not work with Misskey v13.5.6 to v13.9.2 (the latest version). While the same bot configuration is compatible with Misskey v12.118.1, it does not seem to work with version 13.5.6+. Despite granting the API token full access by selecting the "enable all" option, I still received an error message stating that I am not authorized to post using that API when attempting to run the bot.

ℹ 2023-03-10 07:22:34,706 - pleroma_bot - INFO - config path: /root/misskey-bot/config.yml 
ℹ 2023-03-10 07:22:34,707 - pleroma_bot - INFO - tweets temp folder: /root/misskey-bot/tweets 
ℹ 2023-03-10 07:22:34,710 - pleroma_bot - INFO - ====================================== 
ℹ 2023-03-10 07:22:34,710 - pleroma_bot - INFO - Processing user:       karinya 
ℹ 2023-03-10 07:22:35,208 - pleroma_bot - INFO - Instance appears to be Misskey ฅ^•ﻌ•^ฅ 
Gathering tweets... 26
ℹ 2023-03-10 07:22:37,585 - pleroma_bot - INFO - tweets gathered:        24 
Processing tweets... : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 24/24 [00:03<00:00,  7.02it/s]
ℹ 2023-03-10 07:22:41,024 - pleroma_bot - INFO - tweets to post:         24 
Posting tweets... :   0%|                                                                                                                                  | 0/24 [00:00<?, ?it/s]✖ 2023-03-10 07:22:41,404 - pleroma_bot - ERROR - Exception occurred for user, skipping... (cli.py:717) 
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/pleroma_bot/cli.py", line 684, in main
    post_id = user.post(
  File "/usr/local/lib/python3.8/dist-packages/pleroma_bot/_utils.py", line 785, in post
    post_id = self.post_misskey(tweet, poll, sensitive, media, cw=cw)
  File "/usr/local/lib/python3.8/dist-packages/pleroma_bot/_misskey.py", line 132, in post_misskey
    response.raise_for_status()
  File "/usr/local/lib/python3.8/dist-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://never.bid/api/notes/create
Posting tweets... :   0%|  
@robertoszek
Copy link
Owner

Hi!

Weird.
Which version of the bot are you on?
You can check by running:

pleroma-bot --version

I've been running the bot against the instance misskey.io, which is running Misskey v13.9.1 and it's able to create notes as far as I can tell.

The latest release candidate as of now for the bot is v1.2.1rc20, which you can install like so:

pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple pleroma-bot==1.2.1rc20

That's the version of the bot that I'm running, give it a try and see if it makes any difference in your case.

I'm curious, did you run into this issue when upgrading your Misskey instance?
As in, the bot was working on the old Misskey release and after upgrading to the new one you ran into the 401's Unauthorized errors with the bot using your previous tokens?

Oh, and did you generate new tokens on the new Misskey version and they also didn't work?
Just trying to understand a little more the context here, so I can try to replicate it on my end.

Next thing we could try is to make a call directly to the Misskey API of your target instance using your token (with cURL, for example) to see whether the API is working fine and the issue is with the bot or not.

@ooozerooo
Copy link
Author

ooozerooo commented Mar 10, 2023

Hi! Thank you for your prompt reply :)

I installed using pip so the version was v1.2.0. After I reinstalled it using the method you provided the bot seems to work fine now with the version being v1.2.1rc20 .

did you run into this issue when upgrading your Misskey instance?

Not really. I tried to install the bot today without doing any upgrades. After I found out the bot didn't work with my instance (v13.9.2) I then tested the bot with several v13 instances (including misskey.io) and the unauthorized 401 problem persisted, while the same config worked perfectly for v12 instances (and for pleroma and mastodon instances).

You could try testing if using v1.2.0 for misskey v13.5.6+ would run into the same problem, but i guess it's no big deal as bump the bot to the latest version seems to solve this :)

Thank you so much for your help!

@ooozerooo
Copy link
Author

Oh and may i ask if it's normal that 400 Client Error: Bad Request for url: https://never.bid/api/notes/create happens quite often?

Almost every time I run the bot I get something like the codes below

ℹ 2023-03-10 11:52:23,538 - pleroma_bot - INFO - config path: /root/misskey-bot/config.yml 
ℹ 2023-03-10 11:52:23,538 - pleroma_bot - INFO - tweets temp folder: /root/misskey-bot/tweets 
ℹ 2023-03-10 11:52:23,543 - pleroma_bot - INFO - ====================================== 
ℹ 2023-03-10 11:52:23,544 - pleroma_bot - INFO - Processing user:       karinya 
ℹ 2023-03-10 11:52:23,656 - pleroma_bot - INFO - Instance appears to be Misskey ฅ^•ﻌ•^ฅ 
Gathering tweets... 21
ℹ 2023-03-10 11:52:24,738 - pleroma_bot - INFO - tweets gathered:        21 
Processing tweets... : 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 21/21 [00:02<00:00,  8.02it/s]
ℹ 2023-03-10 11:52:27,374 - pleroma_bot - INFO - tweets to post:         18 
Posting tweets... :   0%|                                                                                                                                  | 0/18 [00:00<?, ?it/s]ℹ 2023-03-10 11:52:27,874 - pleroma_bot - INFO - Post in Misskey:       <Response [200]> 
Posting tweets... :   6%|██████▊                                                                                                                   | 1/18 [00:00<00:08,  2.00it/s]ℹ 2023-03-10 11:52:28,466 - pleroma_bot - INFO - Post in Misskey:       <Response [200]> 
Posting tweets... :  11%|█████████████▌                                                                                                            | 2/18 [00:01<00:08,  1.80it/s]ℹ 2023-03-10 11:52:30,314 - pleroma_bot - INFO - Post in Misskey:       <Response [200]> 
Posting tweets... :  17%|████████████████████▎                                                                                                     | 3/18 [00:02<00:17,  1.15s/it]ℹ 2023-03-10 11:52:30,881 - pleroma_bot - INFO - Post in Misskey:       <Response [200]> 
Posting tweets... :  22%|███████████████████████████                                                                                               | 4/18 [00:03<00:12,  1.09it/s]✖ 2023-03-10 11:52:34,008 - pleroma_bot - ERROR - Exception occurred for user, skipping... (cli.py:721) 
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/pleroma_bot/cli.py", line 688, in main
    post_id = user.post(
  File "/usr/local/lib/python3.8/dist-packages/pleroma_bot/_utils.py", line 798, in post
    post_id = self.post_misskey(tweet, poll, sensitive, media, cw=cw)
  File "/usr/local/lib/python3.8/dist-packages/pleroma_bot/_misskey.py", line 130, in post_misskey
    response.raise_for_status()
  File "/usr/local/lib/python3.8/dist-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://never.bid/api/notes/create

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

2 participants