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

error #127

Open
SJoWie80 opened this issue Mar 21, 2023 · 2 comments
Open

error #127

SJoWie80 opened this issue Mar 21, 2023 · 2 comments

Comments

@SJoWie80
Copy link

SJoWie80 commented Mar 21, 2023

Hello,

Any idea? i get firstime running (with empty tweets folder etc): pleroma-bot --forceDate 2023-02-28

Traceback (most recent call last):
  File "/home/joey/.local/lib/python3.10/site-packages/pleroma_bot/cli.py", line 688, in main
    post_id = user.post(
  File "/home/joey/.local/lib/python3.10/site-packages/pleroma_bot/_utils.py", line 796, in post
    post_id = self.post_pleroma(tweet, poll, sensitive, media, cw=cw)
  File "/home/joey/.local/lib/python3.10/site-packages/pleroma_bot/_pleroma.py", line 307, in post_pleroma
    response.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://<*>/api/v1/media

Second time running: pleroma-bot --forceDate 2023-02-28

Traceback (most recent call last):
  File "/home/joey/.local/lib/python3.10/site-packages/pleroma_bot/cli.py", line 688, in main
    post_id = user.post(
  File "/home/joey/.local/lib/python3.10/site-packages/pleroma_bot/_utils.py", line 796, in post
    post_id = self.post_pleroma(tweet, poll, sensitive, media, cw=cw)
  File "/home/joey/.local/lib/python3.10/site-packages/pleroma_bot/_pleroma.py", line 231, in post_pleroma
    item = media[key][0]
KeyError: '4nil9b792e439hiuvld'
Posting tweets... :   0%| 

i om on the latest version: 1.2.1rc20
Connecting to an pleroma server

My config file

pleroma_base_url: <*>
max_tweets: 40
users:
- twitter_username: <*>
  pleroma_username: <*>
  pleroma_token: <*>
  rss: <*>
  signature: true

ofcourze with the right info instead of the <*> :)

Regards,
Joey

@robertoszek
Copy link
Owner

Hi!
The second error seems to be due to the tweets folder having leftover files from the first failed try, so that's no the real issue here.

requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://<*>/api/v1/media
Very interesting, an error HTTP 404 Not Found seems to be returned from the endpoint https://<*>/api/v1/media

You mention the server is running Pleroma, do you know which version specifically?
Perhaps there were some changes on a newer version to their API?

Could you try the endpoint directly like this to confirm it exists?:

$ echo "test" > test.txt
$ curl -i -X POST -H 'Authorization: Bearer YOURPLEROMATOKEN' \
-H "Content-Type: multipart/form-data" -F "file=@test.txt" https://<*>/api/v1/media

I find it a bit weird it returns 404, it shouldn't at least according to their documentation:
https://api.pleroma.social/#operation/MediaController.create

@SJoWie80
Copy link
Author

Hi,

pleroma version is 2.5.1
The result of the curl is:

HTTP/2 200
server: nginx/1.22.1
date: Wed, 22 Mar 2023 08:30:22 GMT
content-type: application/json; charset=utf-8
content-length: 466
access-control-allow-credentials: true
access-control-allow-origin: *
access-control-expose-headers: Link,X-RateLimit-Reset,X-RateLimit-Limit,X-RateLimit-Remaining,X-Request-Id,Idempotency-Key
cache-control: max-age=0, private, must-revalidate
content-security-policy: upgrade-insecure-requests;script-src 'self' 'wasm-unsafe-eval';connect-src 'self' blob: https:// wss://;media-src 'self' https:;img-src 'self' data: blob: https:;default-src 'none';base-uri 'self';frame-ancestors 'none';style-src 'self' 'unsafe-inline';font-src 'self';manifest-src 'self';
permissions-policy: interest-cohort=()
referrer-policy: same-origin
x-content-type-options: nosniff
x-download-options: noopen
x-frame-options: DENY
x-permitted-cross-domain-policies: none
x-request-id: F06wixnKYmLpkFIADQMh
x-xss-protection: 1; mode=block
set-cookie: __Host-pleroma_key=SFMyNTY.g3QAAAABbQAAAAtvYXV0aF90b2tlbm0AAAArTjlwYnJkRlp4Q1ZmUDJMeVhqZkZIa2VXTndQUFN2M2FwOWUyRlRnMlBOaw.yraYKgpYADrOzjIu_pNsgYD9cT0n0aearA5rGn8QlFM; path=/; secure; HttpOnly; SameSite=Lax

{"blurhash":null,"description":"","id":"88","pleroma":{"mime_type":"text/plain"},"preview_url":"https:///media/d9295dfe-f978-4dd5-ac04-fbe689a5be99/test.txt","remote_url":"https:///media/d9295dfe-f978-4dd5-ac04-fbe689a5be99/test.txt","text_url":"https:///media/d9295dfe-f978-4dd5-ac04-fbe689a5be99/test.txt","type":"unknown","url":"https:///media/d9295dfe-f978-4dd5-ac04-fbe689a5be99/test.txt"}

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