Use constants for HTTP headers (#10313)
* Use constants for HTTP headers * Fix ordering * Move 'no-cache' to platform
This commit is contained in:
parent
e64803e701
commit
de9d19d6f4
36 changed files with 408 additions and 444 deletions
|
@ -9,14 +9,15 @@ import logging
|
|||
import re
|
||||
|
||||
import aiohttp
|
||||
from aiohttp.hdrs import REFERER, USER_AGENT
|
||||
import async_timeout
|
||||
import voluptuous as vol
|
||||
import yarl
|
||||
|
||||
from homeassistant.components.tts import Provider, PLATFORM_SCHEMA, CONF_LANG
|
||||
from homeassistant.components.tts import CONF_LANG, PLATFORM_SCHEMA, Provider
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
||||
REQUIREMENTS = ["gTTS-token==1.1.1"]
|
||||
REQUIREMENTS = ['gTTS-token==1.1.1']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -52,10 +53,10 @@ class GoogleProvider(Provider):
|
|||
self.hass = hass
|
||||
self._lang = lang
|
||||
self.headers = {
|
||||
'Referer': "http://translate.google.com/",
|
||||
'User-Agent': ("Mozilla/5.0 (Windows NT 10.0; WOW64) "
|
||||
"AppleWebKit/537.36 (KHTML, like Gecko) "
|
||||
"Chrome/47.0.2526.106 Safari/537.36")
|
||||
REFERER: "http://translate.google.com/",
|
||||
USER_AGENT: ("Mozilla/5.0 (Windows NT 10.0; WOW64) "
|
||||
"AppleWebKit/537.36 (KHTML, like Gecko) "
|
||||
"Chrome/47.0.2526.106 Safari/537.36"),
|
||||
}
|
||||
self.name = 'Google'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue