HTML un-escape Twitter messages.
authorDave Page <dpage@pgadmin.org>
Thu, 24 Aug 2023 09:02:52 +0000 (10:02 +0100)
committerDave Page <dpage@pgadmin.org>
Thu, 24 Aug 2023 09:02:52 +0000 (10:02 +0100)
posttotwitter.py

index 528b337029e7fa84ef150d7c0c3ce462759dccde..bb1b3d620303ad8765d6543f58c99311f84e211f 100755 (executable)
@@ -13,6 +13,7 @@ Copyright (C) 2009-2019 PostgreSQL Global Development Group
 import psycopg2
 import psycopg2.extensions
 import configparser
+import html
 import requests_oauthlib
 
 
@@ -35,7 +36,7 @@ class PostToTwitter(object):
         Actually make a post to twitter!
         """
         r = self.tw.post('https://api.twitter.com/2/tweets', json={
-            'text': msg,
+            'text': html.unescape(msg),
         })
         if r.status_code != 201:
             raise Exception("Could not post to twitter, status code {0}, error {1}".format(r.status_code, r.text))