Commit 59b9c2c3 authored by Romain Bignon's avatar Romain Bignon

html2text does not provide unescape() method anymore, use the one from htmlparser

parent 8dea2985
Pipeline #2613 passed with stages
in 17 minutes and 49 seconds
......@@ -18,7 +18,11 @@
# along with this weboob module. If not, see <http://www.gnu.org/licenses/>.
from html2text import unescape
try:
from HTMLParser import HTMLParser
except ImportError:
from html.parser import HTMLParser
import socket
from datetime import datetime
from dateutil.parser import parse as parse_dt
......@@ -231,9 +235,9 @@ class Contact(_Contact):
self.status = Contact.STATUS_OFFLINE
self.status_msg = u'last connection %s' % profile['last_cnx']
self.summary = unicode(unescape(profile.get('announce', '').strip()))
self.summary = unicode(HTMLParser().unescape(profile.get('announce', '').strip()))
if len(profile.get('shopping_list', '')) > 0:
self.summary += u'\n\nLooking for:\n%s' % unescape(profile['shopping_list'].strip())
self.summary += u'\n\nLooking for:\n%s' % HTMLParser().unescape(profile['shopping_list'].strip())
for photo in profile['pics']:
self.set_photo(photo.split('/')[-1],
......
......@@ -21,10 +21,14 @@
import time
import datetime
from base64 import b64decode
from html2text import unescape
from dateutil import tz
from dateutil.parser import parse as _parse_dt
try:
from HTMLParser import HTMLParser
except ImportError:
from html.parser import HTMLParser
from weboob.capabilities.base import NotLoaded
from weboob.capabilities.chat import CapChat
from weboob.capabilities.messages import CapMessages, CapMessagesPost, Message, Thread
......@@ -220,7 +224,7 @@ class AuMModule(Module, CapMessages, CapMessagesPost, CapDating, CapChat, CapCon
sender=to_unicode(my_name if int(mail['from']) == self.browser.my_id else mails['who']['pseudo']),
receivers=[to_unicode(my_name if int(mail['from']) != self.browser.my_id else mails['who']['pseudo'])],
date=parse_dt(mail['date']),
content=to_unicode(unescape(mail['message'] or '').strip()),
content=to_unicode(HTMLParser().unescape(mail['message'] or '').strip()),
signature=signature,
children=[],
flags=flags)
......
......@@ -19,7 +19,11 @@
from collections import OrderedDict
from datetime import datetime
from html2text import unescape
try:
from HTMLParser import HTMLParser
except ImportError:
from html.parser import HTMLParser
from weboob.capabilities.contact import CapContact, ContactPhoto, Contact, ProfileNode
from weboob.capabilities.dating import CapDating
......@@ -183,7 +187,7 @@ class OkCModule(Module, CapMessages, CapContact, CapMessagesPost, CapDating):
sender=sender.name,
receivers=[receiver.name],
date=date,
content=to_unicode(unescape(message['body'])),
content=to_unicode(HTMLParser().unescape(message['body'])),
children=[],
parent=parent,
signature=sender.get_text(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment