Added error management.
This commit is contained in:
parent
81c0f8a15c
commit
9e99b6e604
|
@ -65,7 +65,6 @@ class Main(object):
|
||||||
"""The main function."""
|
"""The main function."""
|
||||||
# regex_img_src to retrieve urls in <img> tags
|
# regex_img_src to retrieve urls in <img> tags
|
||||||
regex_img_src = re.compile(r"<a\s+(?:[^>]*?\s+)?href=[\"'](.*?)[\"']|<img[^>]+src=\"([^\">]+)\"")
|
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()
|
http = urllib3.PoolManager()
|
||||||
|
|
||||||
clip = CliParse()
|
clip = CliParse()
|
||||||
|
@ -150,7 +149,6 @@ class Main(object):
|
||||||
images.append(resp)
|
images.append(resp)
|
||||||
resp.release_conn()
|
resp.release_conn()
|
||||||
|
|
||||||
|
|
||||||
severalwordsinhashtag = False
|
severalwordsinhashtag = False
|
||||||
# lets see if the rss feed has hashtag
|
# lets see if the rss feed has hashtag
|
||||||
if 'tags' in entry:
|
if 'tags' in entry:
|
||||||
|
|
|
@ -48,8 +48,9 @@ class TootPost:
|
||||||
medias_dicts = []
|
medias_dicts = []
|
||||||
if len(self.img_list) > 0:
|
if len(self.img_list) > 0:
|
||||||
for img in self.img_list:
|
for img in self.img_list:
|
||||||
medias_dicts.append(mastodon.media_post(img.data,
|
media_dict = mastodon.media_post(img.data, img.headers['content-type'])
|
||||||
img.headers['content-type']))
|
if ('error' not in media_dict):
|
||||||
|
medias_dicts.append(media_dict)
|
||||||
|
|
||||||
mastodon.status_post(self.toot,
|
mastodon.status_post(self.toot,
|
||||||
visibility=self.config.get(
|
visibility=self.config.get(
|
||||||
|
|
Loading…
Reference in a new issue