Use constants for HTTP headers (#10313)

* Use constants for HTTP headers

* Fix ordering

* Move 'no-cache' to platform
This commit is contained in:
Fabian Affolter authored and Paulus Schoutsen committed 2017-11-04 12:04:05 -07:00
1 parent e64803e701
commit de9d19d6f4
36 files changed
+408 -444

No files matched your search

+4 -4
View File
@@ -6,14 +6,14 @@ https://home-assistant.io/components/notify.facebook/
"""
import logging
from aiohttp.hdrs import CONTENT_TYPE
import requests
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.notify import (
ATTR_TARGET, ATTR_DATA, PLATFORM_SCHEMA, BaseNotificationService)
ATTR_DATA, ATTR_TARGET, PLATFORM_SCHEMA, BaseNotificationService)
from homeassistant.const import CONTENT_TYPE_JSON
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
@@ -70,7 +70,7 @@ class FacebookNotificationService(BaseNotificationService):
import json
resp = requests.post(BASE_URL, data=json.dumps(body),
params=payload,
headers={'Content-Type': CONTENT_TYPE_JSON},
headers={CONTENT_TYPE: CONTENT_TYPE_JSON},
timeout=10)
if resp.status_code != 200:
obj = resp.json()