Skip to content

Commit

Permalink
Attempt to update twitter media posting to api v2
Browse files Browse the repository at this point in the history
Seems posting with images got broken in the update to api v2, let's see
if the fix is this simple.
  • Loading branch information
mhagander committed Dec 12, 2023
1 parent 40f5333 commit 7b593df
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion postgresqleu/util/messaging/twitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ def post(self, tweet, image=None, replytotweetid=None):
}, timeout=30)
if r.status_code != 200:
return (None, 'Media upload: {}'.format(r.text))
d['media_ids'] = r.json()['media_id']
d['media'] = {
'media_ids': r.json()['media_id'],
}

while d['text']:
r = self.tw.post('https://api.twitter.com/2/tweets', json=d, timeout=30)
Expand Down

0 comments on commit 7b593df

Please sign in to comment.