From 585214f3a4d055ba397d856e95ca8a93c3ee2cc2 Mon Sep 17 00:00:00 2001 From: Fabian Affolter <mail@fabian-affolter.ch> Date: Sun, 13 Oct 2019 22:29:48 +0200 Subject: [PATCH] Upgrade Mastodon.py to 1.5.0 (#27598) --- homeassistant/components/mastodon/manifest.json | 2 +- homeassistant/components/mastodon/notify.py | 10 +++------- requirements_all.txt | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/mastodon/manifest.json b/homeassistant/components/mastodon/manifest.json index e041ba2f669..cacdf9dd502 100644 --- a/homeassistant/components/mastodon/manifest.json +++ b/homeassistant/components/mastodon/manifest.json @@ -3,7 +3,7 @@ "name": "Mastodon", "documentation": "https://www.home-assistant.io/integrations/mastodon", "requirements": [ - "Mastodon.py==1.4.6" + "Mastodon.py==1.5.0" ], "dependencies": [], "codeowners": [ diff --git a/homeassistant/components/mastodon/notify.py b/homeassistant/components/mastodon/notify.py index e7f7de5917f..88716de5773 100644 --- a/homeassistant/components/mastodon/notify.py +++ b/homeassistant/components/mastodon/notify.py @@ -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: diff --git a/requirements_all.txt b/requirements_all.txt index 9a9540c8747..bf36c898b1e 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -38,7 +38,7 @@ Adafruit-SHT31==1.0.2 HAP-python==2.6.0 # homeassistant.components.mastodon -Mastodon.py==1.4.6 +Mastodon.py==1.5.0 # homeassistant.components.orangepi_gpio OPi.GPIO==0.3.6 -- GitLab