mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Upgrade Mastodon.py to 1.5.0 (#27598)
This commit is contained in:
parent
5e79408708
commit
585214f3a4
@ -3,7 +3,7 @@
|
|||||||
"name": "Mastodon",
|
"name": "Mastodon",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/mastodon",
|
"documentation": "https://www.home-assistant.io/integrations/mastodon",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"Mastodon.py==1.4.6"
|
"Mastodon.py==1.5.0"
|
||||||
],
|
],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": [
|
"codeowners": [
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
"""Mastodon platform for notify component."""
|
"""Mastodon platform for notify component."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from mastodon import Mastodon
|
||||||
|
from mastodon.Mastodon import MastodonAPIError, MastodonUnauthorizedError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
|
from homeassistant.components.notify import PLATFORM_SCHEMA, BaseNotificationService
|
||||||
from homeassistant.const import CONF_ACCESS_TOKEN
|
from homeassistant.const import CONF_ACCESS_TOKEN
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
from homeassistant.components.notify import PLATFORM_SCHEMA, BaseNotificationService
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
CONF_BASE_URL = "base_url"
|
CONF_BASE_URL = "base_url"
|
||||||
@ -28,9 +29,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||||||
|
|
||||||
def get_service(hass, config, discovery_info=None):
|
def get_service(hass, config, discovery_info=None):
|
||||||
"""Get the Mastodon notification service."""
|
"""Get the Mastodon notification service."""
|
||||||
from mastodon import Mastodon
|
|
||||||
from mastodon.Mastodon import MastodonUnauthorizedError
|
|
||||||
|
|
||||||
client_id = config.get(CONF_CLIENT_ID)
|
client_id = config.get(CONF_CLIENT_ID)
|
||||||
client_secret = config.get(CONF_CLIENT_SECRET)
|
client_secret = config.get(CONF_CLIENT_SECRET)
|
||||||
access_token = config.get(CONF_ACCESS_TOKEN)
|
access_token = config.get(CONF_ACCESS_TOKEN)
|
||||||
@ -60,8 +58,6 @@ class MastodonNotificationService(BaseNotificationService):
|
|||||||
|
|
||||||
def send_message(self, message="", **kwargs):
|
def send_message(self, message="", **kwargs):
|
||||||
"""Send a message to a user."""
|
"""Send a message to a user."""
|
||||||
from mastodon.Mastodon import MastodonAPIError
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._api.toot(message)
|
self._api.toot(message)
|
||||||
except MastodonAPIError:
|
except MastodonAPIError:
|
||||||
|
@ -38,7 +38,7 @@ Adafruit-SHT31==1.0.2
|
|||||||
HAP-python==2.6.0
|
HAP-python==2.6.0
|
||||||
|
|
||||||
# homeassistant.components.mastodon
|
# homeassistant.components.mastodon
|
||||||
Mastodon.py==1.4.6
|
Mastodon.py==1.5.0
|
||||||
|
|
||||||
# homeassistant.components.orangepi_gpio
|
# homeassistant.components.orangepi_gpio
|
||||||
OPi.GPIO==0.3.6
|
OPi.GPIO==0.3.6
|
||||||
|
Loading…
x
Reference in New Issue
Block a user