Added error management.

This commit is contained in:
Julian Murgia 2017-07-06 20:26:51 +02:00
parent 81c0f8a15c
commit 9e99b6e604
2 changed files with 3 additions and 4 deletions

View file

@ -65,7 +65,6 @@ class Main(object):
"""The main function."""
# regex_img_src to retrieve urls in <img> tags
regex_img_src = re.compile(r"<a\s+(?:[^>]*?\s+)?href=[\"'](.*?)[\"']|<img[^>]+src=\"([^\">]+)\"")
regex_strip_urls = re.compile(r"([a-z]+\.twitter\.com(\/\S+)?|https?:\/\/twitter\.com((\/\w+)?)+)")
http = urllib3.PoolManager()
clip = CliParse()
@ -150,7 +149,6 @@ class Main(object):
images.append(resp)
resp.release_conn()
severalwordsinhashtag = False
# lets see if the rss feed has hashtag
if 'tags' in entry:

View file

@ -48,8 +48,9 @@ class TootPost:
medias_dicts = []
if len(self.img_list) > 0:
for img in self.img_list:
medias_dicts.append(mastodon.media_post(img.data,
img.headers['content-type']))
media_dict = mastodon.media_post(img.data, img.headers['content-type'])
if ('error' not in media_dict):
medias_dicts.append(media_dict)
mastodon.status_post(self.toot,
visibility=self.config.get(