Twitter apiv2 requiets json format input
authorMagnus Hagander <magnus@hagander.net>
Mon, 26 Jun 2023 09:39:08 +0000 (11:39 +0200)
committerMagnus Hagander <magnus@hagander.net>
Mon, 26 Jun 2023 09:39:08 +0000 (11:39 +0200)
Missed that in updating the endpoint.

pgweb/news/management/commands/twitter_post.py

index bc93f29da6919f059672b677297be4f484296da0..b6acbc844b681d0cff0420c4f67a2b1759446461 100644 (file)
@@ -39,7 +39,7 @@ class Command(BaseCommand):
         for a in articles:
             # We hardcode 30 chars for the URL shortener. And then 10 to cover the intro and spacing.
             statusstr = "News: {0} {1}/about/news/{2}-{3}/".format(a.title[:140 - 40], settings.SITE_ROOT, slugify(a.title), a.id)
-            r = tw.post('https://api.twitter.com/2/tweets', data={
+            r = tw.post('https://api.twitter.com/2/tweets', json={
                 'text': statusstr,
             })
             if r.status_code != 201: