mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Timeout and Constant added
This commit is contained in:
parent
e89aa6b2d6
commit
d09dcc4b03
@ -13,6 +13,7 @@ import voluptuous as vol
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.components.notify import (
|
||||
ATTR_TARGET, PLATFORM_SCHEMA, BaseNotificationService)
|
||||
from homeassistant.const import CONTENT_TYPE_JSON
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -42,7 +43,7 @@ class FacebookNotificationService(BaseNotificationService):
|
||||
targets = kwargs.get(ATTR_TARGET)
|
||||
|
||||
if not targets:
|
||||
_LOGGER.info("At least 1 target is required")
|
||||
_LOGGER.error("At least 1 target is required")
|
||||
return
|
||||
|
||||
for target in targets:
|
||||
@ -53,7 +54,8 @@ class FacebookNotificationService(BaseNotificationService):
|
||||
import json
|
||||
resp = requests.post(BASE_URL, data=json.dumps(body),
|
||||
params=payload,
|
||||
headers={'Content-Type': 'application/json'})
|
||||
headers={'Content-Type': CONTENT_TYPE_JSON},
|
||||
timeout=10)
|
||||
if resp.status_code != 200:
|
||||
obj = resp.json()
|
||||
error_message = obj['error']['message']
|
||||
|
Loading…
x
Reference in New Issue
Block a user