Upgrade Mastodon.py to 1.5.0 (#27598)
This commit is contained in:
1 parent
5e79408708
commit
585214f3a4
3 files changed
+5
-9
No files matched your search
@@ -1,13 +1,14 @@
|
||||
"""Mastodon platform for notify component."""
|
||||
import logging
|
||||
|
||||
from mastodon import Mastodon
|
||||
from mastodon.Mastodon import MastodonAPIError, MastodonUnauthorizedError
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.notify import PLATFORM_SCHEMA, BaseNotificationService
|
||||
from homeassistant.const import CONF_ACCESS_TOKEN
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from homeassistant.components.notify import PLATFORM_SCHEMA, BaseNotificationService
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
CONF_BASE_URL = "base_url"
|
||||
@@ -28,9 +29,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
|
||||
def get_service(hass, config, discovery_info=None):
|
||||
"""Get the Mastodon notification service."""
|
||||
from mastodon import Mastodon
|
||||
from mastodon.Mastodon import MastodonUnauthorizedError
|
||||
|
||||
client_id = config.get(CONF_CLIENT_ID)
|
||||
client_secret = config.get(CONF_CLIENT_SECRET)
|
||||
access_token = config.get(CONF_ACCESS_TOKEN)
|
||||
@@ -60,8 +58,6 @@ class MastodonNotificationService(BaseNotificationService):
|
||||
|
||||
def send_message(self, message="", **kwargs):
|
||||
"""Send a message to a user."""
|
||||
from mastodon.Mastodon import MastodonAPIError
|
||||
|
||||
try:
|
||||
self._api.toot(message)
|
||||
except MastodonAPIError:
|
||||
|
||||
Reference in new issue
Block a user