Skip to content

Commit

Permalink
Merge pull request #105 from NabuCasa/dev
Browse files Browse the repository at this point in the history
Release 0.25
  • Loading branch information
pvizeli authored Nov 5, 2019
2 parents 0b3e617 + 4c9c326 commit e0b9adf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
9 changes: 7 additions & 2 deletions hass_nabucasa/voice.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Voice handler with Azure."""
from datetime import datetime
from enum import Enum
import logging
from typing import Optional
import xml.etree.ElementTree as ET

Expand All @@ -12,6 +13,9 @@
from .utils import utc_from_timestamp, utcnow


_LOGGER = logging.getLogger(__name__)


class VoiceError(Exception):
"""General Voice error."""

Expand Down Expand Up @@ -86,14 +90,15 @@ async def process_stt(
f"{self._endpoint_stt}?language={language}",
headers={
CONTENT_TYPE: content,
AUTHORIZATION: self._token,
AUTHORIZATION: f"Bearer {self._token}",
ACCEPT: "application/json;text/xml",
},
data=stream,
expect100=True,
chunked=True,
) as resp:
if resp.status != 200:
_LOGGER.error("Can't process Speech: %d", resp.status)
raise VoiceReturnError()
data = await resp.json()

Expand Down Expand Up @@ -123,7 +128,7 @@ async def process_tts(self, text, language, gender: Gender) -> bytes:
self._endpoint_tts,
headers={
CONTENT_TYPE: "application/ssml+xml",
AUTHORIZATION: self._token,
AUTHORIZATION: f"Bearer {self._token}",
"X-Microsoft-OutputFormat": "audio-16khz-128kbitrate-mono-mp3",
},
data=ET.tostring(xml_body),
Expand Down
4 changes: 2 additions & 2 deletions requirements_tests.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
flake8==3.7.8
flake8==3.7.9
pylint==2.4.2
pytest==5.2.0
pytest==5.2.2
pytest-timeout==1.3.3
pytest-aiohttp==0.3.0
black==19.10b0
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup

VERSION = "0.24"
VERSION = "0.25"

setup(
name="hass-nabucasa",
Expand Down Expand Up @@ -30,7 +30,7 @@
install_requires=[
"warrant==0.6.1",
"snitun==0.20",
"acme==0.38.0",
"acme==0.39.0",
"cryptography>=2.5",
"attrs>=18.2.0",
"pytz",
Expand Down

0 comments on commit e0b9adf

Please sign in to comment.