summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Page2023-08-24 09:02:52 +0000
committerDave Page2023-08-24 09:02:52 +0000
commitc7271662c7726749d11e47f3064bec80b0e95c4a (patch)
tree7f6ad639d41ad522ae73cb87ee61da48d83dcd27
parentff3045768378630089504bfb0f7a212ae2ae5047 (diff)
HTML un-escape Twitter messages.
-rwxr-xr-xposttotwitter.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/posttotwitter.py b/posttotwitter.py
index 528b337..bb1b3d6 100755
--- a/posttotwitter.py
+++ b/posttotwitter.py
@@ -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))