pyatv: TTS error on version 0.9.8 (2.2.0)
Describe the bug
Getting an error from HA API when testing out TTS from the homepod mini.
Testing out TTS on google mini and worked fine.
Error log
2021-12-17 15:33:49 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139695694657808] HTTP Error 403: Forbidden
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/components/tts/__init__.py", line 200, in async_say_handle
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 663, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 896, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 700, in _handle_entity_call
await result
File "/config/custom_components/apple_tv/media_player.py", line 286, in async_play_media
await self.atv.stream.stream_file(media_id)
File "/usr/local/lib/python3.9/site-packages/pyatv/core/facade.py", line 382, in stream_file
await self.relay("stream_file")(file, **kwargs)
File "/usr/local/lib/python3.9/site-packages/pyatv/protocols/raop/__init__.py", line 350, in stream_file
audio_file = await open_source(
File "/usr/local/lib/python3.9/site-packages/pyatv/protocols/raop/audio_source.py", line 457, in open_source
return await InternetSource.open(source, sample_rate, channels, sample_size)
File "/usr/local/lib/python3.9/site-packages/pyatv/protocols/raop/audio_source.py", line 339, in open
source = await loop.run_in_executor(None, PatchedIceCastClient, url)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.9/site-packages/miniaudio.py", line 1091, in __init__
with urllib.request.urlopen(req) as result:
File "/usr/local/lib/python3.9/urllib/request.py", line 214, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/lib/python3.9/urllib/request.py", line 523, in open
response = meth(req, response)
File "/usr/local/lib/python3.9/urllib/request.py", line 632, in http_response
response = self.parent.error(
File "/usr/local/lib/python3.9/urllib/request.py", line 561, in error
return self._call_chain(*args)
File "/usr/local/lib/python3.9/urllib/request.py", line 494, in _call_chain
result = func(*args)
File "/usr/local/lib/python3.9/urllib/request.py", line 641, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
How to reproduce the bug?
Type in a TTS message for homepod mini entity and get error right away.
What is expected behavior?
Message to come through
Operating System
Docker
Python
3.9.7
pyatv
0.9.8
Device
Apple HomePod Mini
Additional context
System Health
version: core-2021.12.3
installation_type: Home Assistant Container
dev: false
hassio: false
docker: true
user: root
virtualenv: false
python_version: 3.9.7
os_name: Linux
os_version: 4.4.0-210-generic
arch: x86_64
timezone: America/Phoenix
Let me know if anything else is needed.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 25 (12 by maintainers)
Commits related to this issue
- raop: Use requests instead of urllib in web stream It seems like urllib is blocked by Cloudflare so better to use a more capable client, i.e. requests. The code has also been tidied up and error hand... — committed to postlund/pyatv by postlund 3 years ago
- raop: Use requests instead of urllib in web stream It seems like urllib is blocked by Cloudflare so better to use a more capable client, i.e. requests. The code has also been tidied up and error hand... — committed to postlund/pyatv by postlund 3 years ago
take your time, no hurry, Also if you need any other logs or help of any kind - just let me know.
#1553, which I just merged, fixes the initial
Forbidden
problem though.