excepted 2 Mastodon Errors
This commit is contained in:
parent
f2d82285af
commit
c8e9d7fd7a
|
@ -82,6 +82,7 @@ class RetootBot(object):
|
||||||
|
|
||||||
# boost mentions
|
# boost mentions
|
||||||
retoots = []
|
retoots = []
|
||||||
|
try:
|
||||||
for notification in self.m.notifications():
|
for notification in self.m.notifications():
|
||||||
if (notification['type'] == 'mention'
|
if (notification['type'] == 'mention'
|
||||||
and notification['status']['id'] not in self.seen_toots):
|
and notification['status']['id'] not in self.seen_toots):
|
||||||
|
@ -98,6 +99,11 @@ class RetootBot(object):
|
||||||
retoots.append('%s: %s' % (
|
retoots.append('%s: %s' % (
|
||||||
notification['status']['account']['acct'],
|
notification['status']['account']['acct'],
|
||||||
re.sub(r'@\S*', '', text_content)))
|
re.sub(r'@\S*', '', text_content)))
|
||||||
|
# If the Mastodon instance returns interesting Errors, add them here:
|
||||||
|
except mastodon.MastodonAPIError:
|
||||||
|
self.log("There was a Mastodon API Error, probably the API is not available.")
|
||||||
|
except mastodon.MastodonNetworkError:
|
||||||
|
self.log("There was a Mastodon Network Error, could not reach the server.")
|
||||||
|
|
||||||
# save state
|
# save state
|
||||||
with os.fdopen(os.open('seen_toots.pickle.part', os.O_WRONLY | os.O_EXCL | os.O_CREAT), 'w') as f:
|
with os.fdopen(os.open('seen_toots.pickle.part', os.O_WRONLY | os.O_EXCL | os.O_CREAT), 'w') as f:
|
||||||
|
|
Loading…
Reference in a new issue