fixing import error
This commit is contained in:
parent
079166e74c
commit
8c778927ee
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
from bot import Bot
|
from bot import Bot
|
||||||
import logging
|
import logging
|
||||||
from mastodon import Mastodon, MastodonServerError
|
import mastodon
|
||||||
import re
|
import re
|
||||||
from report import Report
|
from report import Report
|
||||||
|
|
||||||
|
@ -19,13 +19,13 @@ class MastodonBot(Bot):
|
||||||
"""
|
"""
|
||||||
mentions = []
|
mentions = []
|
||||||
try:
|
try:
|
||||||
m = Mastodon(*user.get_masto_credentials())
|
m = mastodon.Mastodon(*user.get_masto_credentials())
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# logger.error("No Mastodon Credentials in database.", exc_info=True)
|
# logger.error("No Mastodon Credentials in database.", exc_info=True)
|
||||||
return mentions
|
return mentions
|
||||||
try:
|
try:
|
||||||
notifications = m.notifications()
|
notifications = m.notifications()
|
||||||
except MastodonServerError:
|
except mastodon.MastodonServerError:
|
||||||
logger.error("Unknown Mastodon API Error: 502")
|
logger.error("Unknown Mastodon API Error: 502")
|
||||||
return mentions
|
return mentions
|
||||||
for status in notifications:
|
for status in notifications:
|
||||||
|
@ -54,7 +54,7 @@ class MastodonBot(Bot):
|
||||||
|
|
||||||
def post(self, user, report):
|
def post(self, user, report):
|
||||||
try:
|
try:
|
||||||
m = Mastodon(*user.get_masto_credentials())
|
m = mastodon.Mastodon(*user.get_masto_credentials())
|
||||||
except TypeError:
|
except TypeError:
|
||||||
return # no mastodon account for this user.
|
return # no mastodon account for this user.
|
||||||
if report.source == self:
|
if report.source == self:
|
||||||
|
|
Loading…
Reference in a new issue