From: Dave Page Date: Thu, 24 Aug 2023 09:02:52 +0000 (+0100) Subject: HTML un-escape Twitter messages. X-Git-Url: http://git.postgresql.org/gitweb/edit?a=commitdiff_plain;h=c7271662c7726749d11e47f3064bec80b0e95c4a;p=hamn.git HTML un-escape Twitter messages. --- 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))