alandtse / alexa_media_player

This is a custom component to allow control of Amazon Alexa devices in Home Assistant using the unofficial Alexa API.
Apache License 2.0
1.36k stars 264 forks source link

AttributeError: module 'collections' has no attribute 'Callable' #1681

Closed ajarillo1981 closed 1 year ago

ajarillo1981 commented 1 year ago

Describe the bug I was in hassio version 2021.09 and Alexa Media Player worked perfectly. I updated to 2022.07 and it doesn't work anymore. I updated alexa media player to the last version 4.1.0. I receive an error 500 Internal Server Error (Server got itself in trouble) after completing the configuration and confirm I have entered the OTP token in Amazon web. I have installed older versions 4.0.3, 4.0.0 and 3.11.3 with the same results.

To Reproduce Steps to reproduce the behavior:

  1. Install custom components
  2. Configure Alexa Media Player integration entering all data

Expected behavior Complete the configuration and have the entities created in home assistant.

System details

Logs 2022-08-01 10:07:42 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Creating new login 2022-08-01 10:07:42 DEBUG (MainThread) [custom_components.alexa_media.helpers] a**o@g*m: Returning uuid {'uuid': 'xxxxxxxxxxxxxxxxx', 'index': 0} 2022-08-01 10:07:42 DEBUG (MainThread) [alexapy.alexalogin] Creating TOTP for E****4HA 2022-08-01 10:07:42 DEBUG (MainThread) [alexapy.alexalogin] Generating OTP 467791 2022-08-01 10:07:42 DEBUG (MainThread) [alexapy.alexalogin] Login created for xxxxx@gmail.com - amazon.es 2022-08-01 10:07:42 DEBUG (MainThread) [alexapy.alexalogin] Attempting oauth login to https://www.amazon.com/ap/signin?openid.return_to=https://www.amazon.com/ap/maplanding&openid.assoc_handle=amzn_dp_project_dee_ios&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2&openid.oa2.client_id=device:xxxxxxxxxxx&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0&openid.oa2.response_type=token&openid.ns=http://specs.openid.net/auth/2.0&openid.pape.max_auth_age=0&openid.oa2.scope=device_auth_access&language=es_ES 2022-08-01 10:07:42 DEBUG (MainThread) [alexapy.alexalogin] Generating OTP 467791 2022-08-01 10:07:42 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Refreshed 2 modifiers: ['prepend_relative_urls', 'change_host_to_proxy'] 2022-08-01 10:07:42 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Refreshed 1 tests: ['test_amazon_url'] 2022-08-01 10:07:42 DEBUG (MainThread) [alexapy.alexalogin] Generating OTP 467791 2022-08-01 10:07:42 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Refreshed 3 modifiers: ['autofill', 'prepend_relative_urls', 'change_host_to_proxy'] 2022-08-01 10:07:42 DEBUG (MainThread) [alexapy.alexalogin] Generating OTP 467791 2022-08-01 10:07:42 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Generating OTP from 467791 2022-08-01 10:07:55 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Starting proxy for a**o@g*m - amazon.es 2022-08-01 10:07:55 DEBUG (MainThread) [custom_components.alexa_media.config_flow] Found flow_id; adding 192.168.0.5 to known_ips for 300 seconds 2022-08-01 10:07:55 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Received get: http://192.168.0.12:8123/auth/alexamedia/proxy?config_flow_id=ca9bf4d50a855a6f3ccc9047a0xxxxxxxx&callback_url=http://192.168.0.12:8123/auth/alexamedia/callback?flow_id%3Dca9bf4d50a855a6f3ccc9047xxxxxxxx for https://www.amazon.com/ap/signin?openid.return_to=https://www.amazon.com/ap/maplanding&openid.assoc_handle=amzn_dp_project_dee_ios&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2&openid.oa2.client_id=device:xxxxxxxxxxxx&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0&openid.oa2.response_type=token&openid.ns=http://specs.openid.net/auth/2.0&openid.pape.max_auth_age=0&openid.oa2.scope=device_auth_access&language=es_ES 2022-08-01 10:07:55 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Starting auth capture proxy for https://www.amazon.com/ap/signin?openid.return_to=https://www.amazon.com/ap/maplanding&openid.assoc_handle=amzn_dp_project_dee_ios&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2&openid.oa2.client_id=device:xxxxxxxxxxxxx&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0&openid.oa2.response_type=token&openid.ns=http://specs.openid.net/auth/2.0&openid.pape.max_auth_age=0&openid.oa2.scope=device_auth_access&language=es_ES 2022-08-01 10:07:55 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Final headers {'Connection': 'keep-alive', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9', 'Referer': 'https://www.amazon.com/ap/signin?openid.return_to=https://www.amazon.com/ap/maplanding&openid.assoc_handle=amzn_dp_project_dee_ios&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2&openid.oa2.client_id=device:xxxxxx&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0&openid.oa2.response_type=token&openid.ns=http://specs.openid.net/auth/2.0&openid.pape.max_auth_age=0&openid.oa2.scope=device_auth_access&language=es_ES', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'es-ES,es;q=0.9'} 2022-08-01 10:07:55 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Attempting get to https://www.amazon.com/ap/signin?openid.return_to=https://www.amazon.com/ap/maplanding&openid.assoc_handle=amzn_dp_project_dee_ios&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2&openid.oa2.client_id=devicexxxxxxxxxxx&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0&openid.oa2.response_type=token&openid.ns=http://specs.openid.net/auth/2.0&openid.pape.max_auth_age=0&openid.oa2.scope=device_auth_access&language=es_ES headers: {'Connection': 'keep-alive', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9', 'Referer': 'https://www.amazon.com/ap/signin?openid.return_to=https://www.amazon.com/ap/maplanding&openid.assoc_handle=amzn_dp_project_dee_ios&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2&openid.oa2.client_id=device:xxxxxxxx&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0&openid.oa2.response_type=token&openid.ns=http://specs.openid.net/auth/2.0&openid.pape.max_auth_age=0&openid.oa2.scope=device_auth_access&language=es_ES', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'es-ES,es;q=0.9'} cookies: <CookieJar[]> 2022-08-01 10:07:56 DEBUG (MainThread) [authcaptureproxy.helper] GET: https://www.amazon.com/ap/signin?openid.return_to=https://www.amazon.com/ap/maplanding&openid.assoc_handle=amzn_dp_project_dee_ios&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2&openid.oa2.client_id=device:xxxxxxxxxxxxxx&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0&openid.oa2.response_type=token&openid.ns=http://specs.openid.net/auth/2.0&openid.pape.max_auth_age=0&openid.oa2.scope=device_auth_access&language=es_ES with {"host": "www.amazon.com", "connection": "keep-alive", "upgrade-insecure-requests": "1", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36", "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9", "referer": "https://www.amazon.com/ap/signin?openid.return_to=https://www.amazon.com/ap/maplanding&openid.assoc_handle=amzn_dp_project_dee_ios&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2&openid.oa2.client_id=device:xxxxxxxxxxxxxxxxxxxxxxx&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0&openid.oa2.response_type=token&openid.ns=http://specs.openid.net/auth/2.0&openid.pape.max_auth_age=0&openid.oa2.scope=device_auth_access&language=es_ES", "accept-encoding": "gzip, deflate", "accept-language": "es-ES,es;q=0.9"} returned 200:OK with response Headers([('content-type', 'text/html;charset=UTF-8'), ('transfer-encoding', 'chunked'), ('connection', 'keep-alive'), ('server', 'Server'), ('date', 'Mon, 01 Aug 2022 08:07:56 GMT'), ('x-amz-rid', 'ZHZZ58TQC30N9WQF82GA'), ('set-cookie', 'ap-fid=""; Domain=.amazon.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/ap/; Secure'), ('set-cookie', 'session-id=146-0242112-2395177; Domain=.amazon.com; Expires=Tue, 01-Aug-2023 08:07:56 GMT; Path=/; Secure'), ('set-cookie', 'session-id-time=2290061276l; Domain=.amazon.com; Expires=Tue, 01-Aug-2023 08:07:56 GMT; Path=/; Secure'), ('set-cookie', 'lc-main=es_ES; Domain=.amazon.com; Expires=Tue, 01-Aug-2023 08:07:56 GMT; Path=/; Secure'), ('x-xss-protection', '1'), ('x-content-type-options', 'nosniff'), ('x-ua-compatible', 'IE=edge'), ('pragma', 'No-cache'), ('cache-control', 'max-age=0, no-cache, no-store, must-revalidate'), ('expires', 'Thu, 01 Jan 1970 00:00:00 GMT'), ('strict-transport-security', 'max-age=47474747; includeSubDomains; preload'), ('vary', 'Content-Type,Accept-Encoding,X-Amzn-CDN-Cache,X-Amzn-AX-Treatment,User-Agent'), ('p3p', 'policyref="http://www.amazon.com/w3c/p3p.xml",CP="CAO DSP LAW CUR ADM IVAo IVDo CONo OTPo OUR DELi PUBi OTRi BUS PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA HEA PRE LOC GOV OTC "'), ('x-frame-options', 'SAMEORIGIN'), ('permissions-policy', 'interest-cohort=()'), ('x-cache', 'Miss from cloudfront'), ('via', '1.1 950bb8c57b98d41ce5118fe9b4561e36.cloudfront.net (CloudFront)'), ('x-amz-cf-pop', 'MAD51-C1'), ('x-amz-cf-id', 'OhTrVgk4JU8u8_0u6XSQoDADRPFM3exxxxxxxxxxxxx==')]) 2022-08-01 10:07:56 DEBUG (MainThread) [authcaptureproxy.helper] Running coroutine test_amazon_url 2022-08-01 10:07:56 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Refreshed 4 modifiers: ['autofill', 'prepend_relative_urls', 'change_host_to_proxy', 'change_empty_to_proxy'] 2022-08-01 10:07:56 DEBUG (MainThread) [authcaptureproxy.helper] Running function autofill 2022-08-01 10:07:56 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle result = await result File "/config/custom_components/alexa_media/config_flow.py", line 1113, in wrapped return await cls.handler(request, kwargs) File "/usr/local/lib/python3.10/site-packages/authcaptureproxy/auth_capture_proxy.py", line 444, in all_handler text = await run_func(modifier, name, text) File "/usr/local/lib/python3.10/site-packages/authcaptureproxy/helper.py", line 126, in run_func result = func(args, kwargs) File "/usr/local/lib/python3.10/site-packages/alexapy/alexaproxy.py", line 108, in autofill soup: BeautifulSoup = BeautifulSoup(html, "html.parser") File "/usr/local/lib/python3.10/site-packages/bs4/init.py", line 228, in init self._feed() File "/usr/local/lib/python3.10/site-packages/bs4/init.py", line 289, in _feed self.builder.feed(self.markup) File "/usr/local/lib/python3.10/site-packages/bs4/builder/_htmlparser.py", line 215, in feed parser.feed(markup) File "/usr/local/lib/python3.10/html/parser.py", line 110, in feed self.goahead(0) File "/usr/local/lib/python3.10/html/parser.py", line 178, in goahead k = self.parse_html_declaration(i) File "/usr/local/lib/python3.10/html/parser.py", line 269, in parse_html_declaration self.handle_decl(rawdata[i+2:gtpos]) File "/usr/local/lib/python3.10/site-packages/bs4/builder/_htmlparser.py", line 153, in handle_decl self.soup.endData() File "/usr/local/lib/python3.10/site-packages/bs4/init.py", line 365, in endData self.object_was_parsed(o) File "/usr/local/lib/python3.10/site-packages/bs4/init.py", line 370, in object_was_parsed previous_element = most_recent_element or self._most_recent_element File "/usr/local/lib/python3.10/site-packages/bs4/element.py", line 1054, in getattr return self.find(tag) File "/usr/local/lib/python3.10/site-packages/bs4/element.py", line 1292, in find l = self.find_all(name, attrs, recursive, text, 1, kwargs) File "/usr/local/lib/python3.10/site-packages/bs4/element.py", line 1313, in find_all return self._find_all(name, attrs, text, limit, generator, kwargs) File "/usr/local/lib/python3.10/site-packages/bs4/element.py", line 528, in _find_all strainer = SoupStrainer(name, attrs, text, kwargs) File "/usr/local/lib/python3.10/site-packages/bs4/element.py", line 1610, in init self.text = self._normalize_search_value(text) File "/usr/local/lib/python3.10/site-packages/bs4/element.py", line 1615, in _normalize_search_value if (isinstance(value, str) or isinstance(value, collections.Callable) or hasattr(value, 'match') AttributeError: module 'collections' has no attribute 'Callable' 2022-08-01 10:08:11 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Received get: http://192.168.0.12:8123/auth/alexamedia/proxy?config_flow_id=ca9bf4d50a85f3ccc9047a0d4c827xxx &callback_url=http://192.168.0.12:8123/auth/alexamedia/callback?flow_id%3Dca9bf4d50a855a6f3ccc9047xxxxxx for https://www.amazon.com/ap/signin?openid.return_to=https://www.amazon.com/ap/maplanding&openid.assoc_handle=amzn_dp_project_dee_ios&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2&openid.oa2.client_id=devicexxxxxxxxxx&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0&openid.oa2.response_type=token&openid.ns=http://specs.openid.net/auth/2.0&openid.pape.max_auth_age=0&openid.oa2.scope=device_auth_access&language=es_ES 2022-08-01 10:08:11 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Starting auth capture proxy for https://www.amazon.com/ap/signin?openid.return_to=https://www.amazon.com/ap/maplanding&openid.assoc_handle=amzn_dp_project_dee_ios&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2&openid.oa2.client_id=device:xxxxxxxxxxxxx&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0&openid.oa2.response_type=token&openid.ns=http://specs.openid.net/auth/2.0&openid.pape.max_auth_age=0&openid.oa2.scope=device_auth_access&language=es_ES 2022-08-01 10:08:11 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Final headers {'Connection': 'keep-alive', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'es-ES,es;q=0.9'} 2022-08-01 10:08:11 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Attempting get to https://www.amazon.com/ap/signin?openid.return_to=https://www.amazon.com/ap/maplanding&openid.assoc_handle=amzn_dp_project_dee_ios&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2&openid.oa2.client_id=device:xxxxxxxxxxxxxxxxxxxxxxxx&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0&openid.oa2.response_type=token&openid.ns=http://specs.openid.net/auth/2.0&openid.pape.max_auth_age=0&openid.oa2.scope=device_auth_access&language=es_ES headers: {'Connection': 'keep-alive', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'es-ES,es;q=0.9'} cookies: <CookieJar[<Cookie lc-main=es_ES for .amazon.com/>, <Cookie session-id=146-0242112-2395177 for .amazon.com/>, <Cookie session-id-time=2290061276l for .amazon.com/>]> 2022-08-01 10:08:12 DEBUG (MainThread) [authcaptureproxy.helper] GET: https://www.amazon.com/ap/signin?openid.return_to=https://www.amazon.com/ap/maplanding&openid.assoc_handle=amzn_dp_project_dee_ios&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&pageId=amzn_dp_project_dee_ios&accountStatusPolicy=P1&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.mode=checkid_setup&openid.ns.oa2=http://www.amazon.com/ap/ext/oauth/2&openid.oa2.client_id=device:3165653xxxxxxxxxxxxxxxxxxxxxxxxxxx&openid.ns.pape=http://specs.openid.net/extensions/pape/1.0&openid.oa2.response_type=token&openid.ns=http://specs.openid.net/auth/2.0&openid.pape.max_auth_age=0&openid.oa2.scope=device_auth_access&language=es_ES with {"host": "www.amazon.com", "connection": "keep-alive", "upgrade-insecure-requests": "1", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36", "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "accept-encoding": "gzip, deflate", "accept-language": "es-ES,es;q=0.9", "cookie": {"lc-main": "es_ES", "session-id": "146-0242112-2395177", "session-id-time": "2290061276l"}} returned 200:OK with response Headers([('content-type', 'text/html;charset=UTF-8'), ('transfer-encoding', 'chunked'), ('connection', 'keep-alive'), ('server', 'Server'), ('date', 'Mon, 01 Aug 2022 08:08:11 GMT'), ('x-amz-rid', 'xxxxxx'), ('set-cookie', 'ap-fid=""; Domain=.amazon.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/ap/; Secure'), ('set-cookie', 'session-id=146-0242112-2395177; Domain=.amazon.com; Expires=Tue, 01-Aug-2023 08:08:11 GMT; Path=/; Secure'), ('set-cookie', 'session-id-time=2290061291l; Domain=.amazon.com; Expires=Tue, 01-Aug-2023 08:08:11 GMT; Path=/; Secure'), ('set-cookie', 'ubid-main=133-1784227-7474909; Domain=.amazon.com; Expires=Tue, 01-Aug-2023 08:08:11 GMT; Path=/; Secure'), ('x-xss-protection', '1'), ('x-content-type-options', 'nosniff'), ('x-ua-compatible', 'IE=edge'), ('pragma', 'No-cache'), ('cache-control', 'max-age=0, no-cache, no-store, must-revalidate'), ('expires', 'Thu, 01 Jan 1970 00:00:00 GMT'), ('strict-transport-security', 'max-age=47474747; includeSubDomains; preload'), ('vary', 'Content-Type,Accept-Encoding,X-Amzn-CDN-Cache,X-Amzn-AX-Treatment,User-Agent'), ('p3p', 'policyref="http://www.amazon.com/w3c/p3p.xml",CP="CAO DSP LAW CUR ADM IVAo IVDo CONo OTPo OUR DELi PUBi OTRi BUS PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA HEA PRE LOC GOV OTC "'), ('x-frame-options', 'SAMEORIGIN'), ('permissions-policy', 'interest-cohort=()'), ('x-cache', 'Miss from cloudfront'), ('via', '1.1 7f70d83fbdaced88b6e7786ba7daea80.cloudfront.net (CloudFront)'), ('x-amz-cf-pop', 'MAD51-C1'), ('x-amz-cf-id', 'Ai4hXQ6NsWJEDaK3Xqbb6v7_Q43z6UCX2oD3n_Wo8nJgNwEZS0qOXg==')]) 2022-08-01 10:08:12 DEBUG (MainThread) [authcaptureproxy.helper] Running coroutine test_amazon_url 2022-08-01 10:08:12 DEBUG (MainThread) [authcaptureproxy.helper] Running function autofill 2022-08-01 10:08:12 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle result = await result File "/config/custom_components/alexa_media/config_flow.py", line 1113, in wrapped return await cls.handler(request, *kwargs) File "/usr/local/lib/python3.10/site-packages/authcaptureproxy/auth_capture_proxy.py", line 444, in all_handler text = await run_func(modifier, name, text) File "/usr/local/lib/python3.10/site-packages/authcaptureproxy/helper.py", line 126, in run_func result = func(args, kwargs) File "/usr/local/lib/python3.10/site-packages/alexapy/alexaproxy.py", line 108, in autofill soup: BeautifulSoup = BeautifulSoup(html, "html.parser") File "/usr/local/lib/python3.10/site-packages/bs4/init.py", line 228, in init self._feed() File "/usr/local/lib/python3.10/site-packages/bs4/init.py", line 289, in _feed self.builder.feed(self.markup) File "/usr/local/lib/python3.10/site-packages/bs4/builder/_htmlparser.py", line 215, in feed parser.feed(markup) File "/usr/local/lib/python3.10/html/parser.py", line 110, in feed self.goahead(0) File "/usr/local/lib/python3.10/html/parser.py", line 178, in goahead k = self.parse_html_declaration(i) File "/usr/local/lib/python3.10/html/parser.py", line 269, in parse_html_declaration self.handle_decl(rawdata[i+2:gtpos]) File "/usr/local/lib/python3.10/site-packages/bs4/builder/_htmlparser.py", line 153, in handle_decl self.soup.endData() File "/usr/local/lib/python3.10/site-packages/bs4/init.py", line 365, in endData self.object_was_parsed(o) File "/usr/local/lib/python3.10/site-packages/bs4/init.py", line 370, in object_was_parsed previous_element = most_recent_element or self._most_recent_element File "/usr/local/lib/python3.10/site-packages/bs4/element.py", line 1054, in getattr return self.find(tag) File "/usr/local/lib/python3.10/site-packages/bs4/element.py", line 1292, in find l = self.find_all(name, attrs, recursive, text, 1, kwargs) File "/usr/local/lib/python3.10/site-packages/bs4/element.py", line 1313, in find_all return self._find_all(name, attrs, text, limit, generator, kwargs) File "/usr/local/lib/python3.10/site-packages/bs4/element.py", line 528, in _find_all strainer = SoupStrainer(name, attrs, text, **kwargs) File "/usr/local/lib/python3.10/site-packages/bs4/element.py", line 1610, in init self.text = self._normalize_search_value(text) File "/usr/local/lib/python3.10/site-packages/bs4/element.py", line 1615, in _normalize_search_value if (isinstance(value, str) or isinstance(value, collections.Callable) or hasattr(value, 'match') AttributeError: module 'collections' has no attribute 'Callable'

alandtse commented 1 year ago

Your version of beautifulsoup is likely outdated, https://pypi.org/project/beautifulsoup4/. Please update it.

pip3 install --upgrade beautifulsoup4
ajarillo1981 commented 1 year ago

I have run the command inside home assistant container but it doesn't work. It asked to update pip, so I did it and tried again:

bash-5.1# pip3 install --upgrade beautifulsoap4 ERROR: Could not find a version that satisfies the requirement beautifulsoap4 (from versions: none) ERROR: No matching distribution found for beautifulsoap4

[notice] A new release of pip available: 22.1.2 -> 22.2.2 [notice] To update, run: pip install --upgrade pip bash-5.1# pip3 show beautifulsoap4 WARNING: Package(s) not found: beautifulsoap4 bash-5.1# pip3 install beautifulsoap4 ERROR: Could not find a version that satisfies the requirement beautifulsoap4 (from versions: none) ERROR: No matching distribution found for beautifulsoap4

[notice] A new release of pip available: 22.1.2 -> 22.2.2 [notice] To update, run: pip install --upgrade pip bash-5.1# pip install --upgrade pip Requirement already satisfied: pip in /usr/local/lib/python3.10/site-packages (22.1.2) Collecting pip Downloading pip-22.2.2-py3-none-any.whl (2.0 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.0/2.0 MB 9.2 MB/s eta 0:00:00 Installing collected packages: pip Attempting uninstall: pip Found existing installation: pip 22.1.2 Uninstalling pip-22.1.2: Successfully uninstalled pip-22.1.2 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. homeassistant 2022.7.7 requires pip<22.2,>=21.0, but you have pip 22.2.2 which is incompatible. Successfully installed pip-22.2.2 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv bash-5.1# pip3 install beautifulsoap4 ERROR: Could not find a version that satisfies the requirement beautifulsoap4 (from versions: none) ERROR: No matching distribution found for beautifulsoap4 bash-5.1#

alandtse commented 1 year ago

Sorry autocorrect.

beautifulsoup4 not beautifulsoap4.

ajarillo1981 commented 1 year ago

Finally, I have updated beautifulsoup4, but I reboot home assistant and it still doesn't work.... any other idea would be really appreciated. Find below the logs and thanks for the help.

bash-5.1# pip3 install --upgrade beautifulsoup4 Requirement already satisfied: beautifulsoup4 in /usr/local/lib/python3.10/site-packages (4.6.0) Collecting beautifulsoup4 Using cached beautifulsoup4-4.11.1-py3-none-any.whl (128 kB) Requirement already satisfied: soupsieve>1.2 in /usr/local/lib/python3.10/site-packages (from beautifulsoup4) (2.3.2.post1) Installing collected packages: beautifulsoup4 Attempting uninstall: beautifulsoup4 Found existing installation: beautifulsoup4 4.6.0 Uninstalling beautifulsoup4-4.6.0: Successfully uninstalled beautifulsoup4-4.6.0 Successfully installed beautifulsoup4-4.11.1 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv bash-5.1#

2022-08-05 16:22:03 DEBUG (MainThread) [authcaptureproxy.helper] Running coroutine test_amazon_url 2022-08-05 16:22:03 DEBUG (MainThread) [authcaptureproxy.auth_capture_proxy] Refreshed 4 modifiers: ['autofill', 'prepend_relative_urls', 'change_host_to_proxy', 'change_empty_to_proxy'] 2022-08-05 16:22:03 DEBUG (MainThread) [authcaptureproxy.helper] Running function autofill 2022-08-05 16:22:03 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle result = await result File "/config/custom_components/alexa_media/config_flow.py", line 870, in wrapped return await cls.handler(request, *kwargs) File "/usr/local/lib/python3.10/site-packages/authcaptureproxy/auth_capture_proxy.py", line 444, in all_handler text = await run_func(modifier, name, text) File "/usr/local/lib/python3.10/site-packages/authcaptureproxy/helper.py", line 126, in run_func result = func(args, kwargs) File "/usr/local/lib/python3.10/site-packages/alexapy/alexaproxy.py", line 108, in autofill soup: BeautifulSoup = BeautifulSoup(html, "html.parser") File "/usr/local/lib/python3.10/site-packages/bs4/init.py", line 228, in init self._feed() File "/usr/local/lib/python3.10/site-packages/bs4/init.py", line 289, in _feed self.builder.feed(self.markup) File "/usr/local/lib/python3.10/site-packages/bs4/builder/_htmlparser.py", line 215, in feed parser.feed(markup) File "/usr/local/lib/python3.10/html/parser.py", line 110, in feed self.goahead(0) File "/usr/local/lib/python3.10/html/parser.py", line 178, in goahead k = self.parse_html_declaration(i) File "/usr/local/lib/python3.10/html/parser.py", line 269, in parse_html_declaration self.handle_decl(rawdata[i+2:gtpos]) File "/usr/local/lib/python3.10/site-packages/bs4/builder/_htmlparser.py", line 153, in handle_decl self.soup.endData() File "/usr/local/lib/python3.10/site-packages/bs4/init.py", line 365, in endData self.object_was_parsed(o) File "/usr/local/lib/python3.10/site-packages/bs4/init.py", line 370, in object_was_parsed previous_element = most_recent_element or self._most_recent_element File "/usr/local/lib/python3.10/site-packages/bs4/element.py", line 1054, in getattr return self.find(tag) File "/usr/local/lib/python3.10/site-packages/bs4/element.py", line 1292, in find l = self.find_all(name, attrs, recursive, text, 1, kwargs) File "/usr/local/lib/python3.10/site-packages/bs4/element.py", line 1313, in find_all return self._find_all(name, attrs, text, limit, generator, kwargs) File "/usr/local/lib/python3.10/site-packages/bs4/element.py", line 528, in _find_all strainer = SoupStrainer(name, attrs, text, kwargs) File "/usr/local/lib/python3.10/site-packages/bs4/element.py", line 1610, in init self.text = self._normalize_search_value(text) File "/usr/local/lib/python3.10/site-packages/bs4/element.py", line 1615, in _normalize_search_value if (isinstance(value, str) or isinstance(value, collections.Callable) or hasattr(value, 'match') AttributeError: module 'collections' has no attribute 'Callable'

ajarillo1981 commented 1 year ago

I have checked alexapy version and tried to update but everything is updated. Is there any other troubleshooting I can do? The integration was really helpful to me and I would like to help you to fix the issue. Find the logs below and a capture screen attached: Captura

bash-5.1# pip3 show alexapy

Name: alexapy Version: 1.26.1 Summary: Python API to control Amazon Echo Devices Programmatically. Home-page: https://gitlab.com/keatontaylor/alexapy Author: Keaton Taylor Author-email: keatonstaylor@gmail.com License: Apache-2.0 Location: /usr/local/lib/python3.10/site-packages Requires: aiofiles, authcaptureproxy, backoff, beautifulsoup4, certifi, cryptography, pyotp, requests, simplejson, yarl Required-by: bash-5.1#

bash-5.1# pip3 install --upgrade alexapy Requirement already satisfied: alexapy in /usr/local/lib/python3.10/site-packages (1.26.1) Requirement already satisfied: certifi in /usr/local/lib/python3.10/site-packages (from alexapy) (2022.6.15) Requirement already satisfied: yarl in /usr/local/lib/python3.10/site-packages (from alexapy) (1.7.2) Requirement already satisfied: aiofiles<1,>0 in /usr/local/lib/python3.10/site-packages (from alexapy) (0.8.0) Requirement already satisfied: cryptography>=35.0 in /usr/local/lib/python3.10/site-packages (from alexapy) (36.0.2) Requirement already satisfied: pyotp>=2.4 in /usr/local/lib/python3.10/site-packages (from alexapy) (2.6.0) Requirement already satisfied: backoff>=1.10 in /usr/local/lib/python3.10/site-packages (from alexapy) (1.11.1) Requirement already satisfied: beautifulsoup4 in /usr/local/lib/python3.10/site-packages (from alexapy) (4.11.1) Requirement already satisfied: authcaptureproxy<2.0.0,>=1.1.4 in /usr/local/lib/python3.10/site-packages (from alexapy) (1.1.4) Requirement already satisfied: simplejson in /usr/local/lib/python3.10/site-packages (from alexapy) (3.17.6) Requirement already satisfied: requests in /usr/local/lib/python3.10/site-packages (from alexapy) (2.28.1) Requirement already satisfied: multidict<7,>=6 in /usr/local/lib/python3.10/site-packages (from authcaptureproxy<2.0.0,>=1.1.4->alexapy) (6.0.2) Requirement already satisfied: importlib-metadata>=3.4.0 in /usr/local/lib/python3.10/site-packages (from authcaptureproxy<2.0.0,>=1.1.4->alexapy) (4.12.0) Requirement already satisfied: aiohttp<4,>=3 in /usr/local/lib/python3.10/site-packages (from authcaptureproxy<2.0.0,>=1.1.4->alexapy) (3.8.1) Requirement already satisfied: httpx in /usr/local/lib/python3.10/site-packages (from authcaptureproxy<2.0.0,>=1.1.4->alexapy) (0.23.0) Requirement already satisfied: typer<1.0,>=0.3 in /usr/local/lib/python3.10/site-packages (from authcaptureproxy<2.0.0,>=1.1.4->alexapy) (0.6.1) Requirement already satisfied: soupsieve>1.2 in /usr/local/lib/python3.10/site-packages (from beautifulsoup4->alexapy) (2.3.2.post1) Requirement already satisfied: cffi>=1.12 in /usr/local/lib/python3.10/site-packages (from cryptography>=35.0->alexapy) (1.15.1) Requirement already satisfied: idna>=2.0 in /usr/local/lib/python3.10/site-packages (from yarl->alexapy) (3.3) Requirement already satisfied: charset-normalizer<3,>=2 in /usr/local/lib/python3.10/site-packages (from requests->alexapy) (2.1.0) Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.10/site-packages (from requests->alexapy) (1.26.11) Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/site-packages (from aiohttp<4,>=3->authcaptureproxy<2.0.0,>=1.1.4->alexapy) (1.2.0) Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/site-packages (from aiohttp<4,>=3->authcaptureproxy<2.0.0,>=1.1.4->alexapy) (21.2.0) Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /usr/local/lib/python3.10/site-packages (from aiohttp<4,>=3->authcaptureproxy<2.0.0,>=1.1.4->alexapy) (4.0.2) Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/site-packages (from aiohttp<4,>=3->authcaptureproxy<2.0.0,>=1.1.4->alexapy) (1.3.0) Requirement already satisfied: pycparser in /usr/local/lib/python3.10/site-packages (from cffi>=1.12->cryptography>=35.0->alexapy) (2.21) Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.10/site-packages (from importlib-metadata>=3.4.0->authcaptureproxy<2.0.0,>=1.1.4->alexapy) (3.8.1) Requirement already satisfied: click<9.0.0,>=7.1.1 in /usr/local/lib/python3.10/site-packages (from typer<1.0,>=0.3->authcaptureproxy<2.0.0,>=1.1.4->alexapy) (8.1.3) Requirement already satisfied: httpcore<0.16.0,>=0.15.0 in /usr/local/lib/python3.10/site-packages (from httpx->authcaptureproxy<2.0.0,>=1.1.4->alexapy) (0.15.0) Requirement already satisfied: rfc3986[idna2008]<2,>=1.3 in /usr/local/lib/python3.10/site-packages (from httpx->authcaptureproxy<2.0.0,>=1.1.4->alexapy) (1.5.0) Requirement already satisfied: sniffio in /usr/local/lib/python3.10/site-packages (from httpx->authcaptureproxy<2.0.0,>=1.1.4->alexapy) (1.2.0) Requirement already satisfied: anyio==3.* in /usr/local/lib/python3.10/site-packages (from httpcore<0.16.0,>=0.15.0->httpx->authcaptureproxy<2.0.0,>=1.1.4->alexapy) (3.6.1) Requirement already satisfied: h11<0.13,>=0.11 in /usr/local/lib/python3.10/site-packages (from httpcore<0.16.0,>=0.15.0->httpx->authcaptureproxy<2.0.0,>=1.1.4->alexapy) (0.12.0)

alandtse commented 1 year ago

The issue is related to the beautifulsoup dependency. There's not much I can do on our side short of ignoring the error which I may put a PR to do since it's just an autofill issue. Of course, this may break another part of the login process.

ajarillo1981 commented 1 year ago

I would really like trying your idea of ignoring the error and see what happens; or if it is another way or workaround for completing the authentication process in other way and enter the results in any config file just let me know.

alandtse commented 1 year ago

I'm not sure what to tell you. The version of beautifulsoup reporting an error you're apparently using isn't the same as what's available and what you've claimed you've installed.

File "/usr/local/lib/python3.10/site-packages/bs4/element.py", line 1615, in _normalize_search_value
if (isinstance(value, str) or isinstance(value, collections.Callable) or hasattr(value, 'match')

But that doesn't match the latest versions. https://bazaar.launchpad.net/~leonardr/beautifulsoup/bs4/view/head:/bs4/element.py#L2062.

In fact, this was changed in beautifulsoup4 in 2021. I assume this is 4.10.0. https://bazaar.launchpad.net/~leonardr/beautifulsoup/bs4/annotate/head:/bs4/element.py#L2062

I'm not sure I'm going to do a release anytime soon to address someone using an out of date dependency. You can try uninstall the alias bs4 as well as beautifulsoup4 and trying to reinstall. Make sure it's what HA will access. Also confirm you don't have a local installation in your /config directory.

EDIT: The change happened at least in 2018.

ajarillo1981 commented 1 year ago

I have checked the version of bs4 and it is version 0.0.1 (beautifulsoup is in 4.6.0). I uninstalled it and reinstalled and it install the same one. I don't understand why this is obsolete, if homeassistant is in a container deployed from an image when I updated hassio core in my raspberry pi 4.

See the logs below:

bash-5.1# pip show bs4 Name: bs4 Version: 0.0.1 Summary: Screen-scraping library Home-page: https://pypi.python.org/pypi/beautifulsoup4 Author: Leonard Richardson Author-email: leonardr@segfault.org License: MIT Location: /usr/local/lib/python3.10/site-packages Requires: beautifulsoup4 Required-by: pyebox, raincloudy bash-5.1#

bash-5.1# pip show beautifulsoup4 Name: beautifulsoup4 Version: 4.6.0 Summary: Screen-scraping library Home-page: http://www.crummy.com/software/BeautifulSoup/bs4/ Author: Leonard Richardson Author-email: leonardr@segfault.org License: MIT Location: /usr/local/lib/python3.10/site-packages Requires: Required-by: alexapy, authcaptureproxy, bs4, enocean, MechanicalSoup, pymeteoclimatic, pymyq, schiene, simplisafe-python bash-5.1#

bash-5.1# pip uninstall bs4 Found existing installation: bs4 0.0.1 Uninstalling bs4-0.0.1: Would remove: /usr/local/lib/python3.10/site-packages/bs4-0.0.1.dist-info/* Proceed (Y/n)? Y Successfully uninstalled bs4-0.0.1 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv bash-5.1#

bash-5.1# pip install bs4 Collecting bs4 Downloading bs4-0.0.1.tar.gz (1.1 kB) Preparing metadata (setup.py) ... done Requirement already satisfied: beautifulsoup4 in /usr/local/lib/python3.10/site-packages (from bs4) (4.6.0) Building wheels for collected packages: bs4 Building wheel for bs4 (setup.py) ... done Created wheel for bs4: filename=bs4-0.0.1-py3-none-any.whl size=1257 sha256=eb3d057912e115cb98539670b9fec9387ef3e950d3f6b398eb5d47b324645882 Stored in directory: /root/.cache/pip/wheels/25/42/45/b773edc52acb16cd2db4cf1a0b47117e2f69bb4eb300ed0e70 Successfully built bs4 Installing collected packages: bs4 Successfully installed bs4-0.0.1 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv bash-5.1#

Any other ideas about how to proceed?

alandtse commented 1 year ago

Use a version of beautifulsoup4 that is supported in python 3.10.

ajarillo1981 commented 1 year ago

I tried to uninstall beatifulsoup and install again and it finally installed the last version. 4.11.1. However the same error is appearing:

bash-5.1# pip uninstall beautifulsoup4 Found existing installation: beautifulsoup4 4.6.0 Uninstalling beautifulsoup4-4.6.0: Would remove: /usr/local/lib/python3.10/site-packages/beautifulsoup4-4.6.0.dist-info/ /usr/local/lib/python3.10/site-packages/bs4/ Proceed (Y/n)? Y Successfully uninstalled beautifulsoup4-4.6.0 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv bash-5.1# pip install beautifulsoup4 Collecting beautifulsoup4 Using cached beautifulsoup4-4.11.1-py3-none-any.whl (128 kB) Requirement already satisfied: soupsieve>1.2 in /usr/local/lib/python3.10/site-packages (from beautifulsoup4) (2.3.2.post1) Installing collected packages: beautifulsoup4 Successfully installed beautifulsoup4-4.11.1 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv bash-5.1#

ajarillo1981 commented 1 year ago

When I reboot hassio appears the old versión of beautifulsoup. It seems the correct versión is not installed. I will check how to update correctly and inform about the results.

ajarillo1981 commented 1 year ago

In every reboot beautifulsoup4 downgrade to 4.6 version. I have been investigating and it seems that one component requires that specific version and it downgrade the version when hassio reboot, but I don´t know how to find what component is. Do you have any clue about how to find that component?

ajarillo1981 commented 1 year ago

I have updated all packages that requires beautifulsoup4 and all of them shows the new version after rebooting, however beautifulsoup4 returns from version 4.11 to 4.6 after the reboot. I don't know how to troubleshoot this and find why the new version of beautifulsoup reinstall the older version:

bash-5.1# pip show beautifulsoup4 Name: beautifulsoup4 Version: 4.6.0 Summary: Screen-scraping library Home-page: http://www.crummy.com/software/BeautifulSoup/bs4/ Author: Leonard Richardson Author-email: leonardr@segfault.org License: MIT Location: /usr/local/lib/python3.10/site-packages Requires: Required-by: simplisafe-python, schiene, pymyq, pymeteoclimatic, MechanicalSoup, enocean, authcaptureproxy, alexapy bash-5.1#

bash-5.1# pip install --upgrade schiene Requirement already satisfied: schiene in /usr/local/lib/python3.10/site-packages (0.23) Collecting schiene Downloading schiene-0.24.tar.gz (4.3 kB) Requirement already satisfied: requests>=2.10.0 in /usr/local/lib/python3.10/site-packages (from schiene) (2.28.1) Requirement already satisfied: beautifulsoup4>=4.4.1 in /usr/local/lib/python3.10/site-packages (from schiene) (4.6.0) Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.10/site-packages (from requests>=2.10.0->schiene) (1.26.11) Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/site-packages (from requests>=2.10.0->schiene) (3.3) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/site-packages (from requests>=2.10.0->schiene) (2022.6.15) Requirement already satisfied: charset-normalizer<3,>=2 in /usr/local/lib/python3.10/site-packages (from requests>=2.10.0->schiene) (2.1.0) Building wheels for collected packages: schiene Building wheel for schiene (setup.py) ... done Created wheel for schiene: filename=schiene-0.24-py3-none-any.whl size=3696 sha256=04f8a107e49f355d66d84ad48319cd093255a128b88cba0f24f72669ef0b59a0 Stored in directory: /root/.cache/pip/wheels/5b/b3/c8/febad8e38615f7b0833006e690101db2a5fe132c7530dc370b Successfully built schiene Installing collected packages: schiene Attempting uninstall: schiene Found existing installation: schiene 0.23 Uninstalling schiene-0.23: Successfully uninstalled schiene-0.23 Successfully installed schiene-0.24 bash-5.1#

bash-5.1# pip install --upgrade pymyq Requirement already satisfied: pymyq in /usr/local/lib/python3.10/site-packages (3.1.4) Collecting pymyq Downloading pymyq-3.1.5-py2.py3-none-any.whl (20 kB) Requirement already satisfied: aiohttp in /usr/local/lib/python3.10/site-packages (from pymyq) (3.8.1) Requirement already satisfied: beautifulsoup4 in /usr/local/lib/python3.10/site-packages (from pymyq) (4.6.0) Requirement already satisfied: pkce in /usr/local/lib/python3.10/site-packages (from pymyq) (1.0.3) Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/site-packages (from aiohttp->pymyq) (21.2.0) Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /usr/local/lib/python3.10/site-packages (from aiohttp->pymyq) (4.0.2) Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/site-packages (from aiohttp->pymyq) (1.7.2) Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/site-packages (from aiohttp->pymyq) (1.3.0) Requirement already satisfied: charset-normalizer<3.0,>=2.0 in /usr/local/lib/python3.10/site-packages (from aiohttp->pymyq) (2.1.0) Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/site-packages (from aiohttp->pymyq) (1.2.0) Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/site-packages (from aiohttp->pymyq) (6.0.2) Requirement already satisfied: idna>=2.0 in /usr/local/lib/python3.10/site-packages (from yarl<2.0,>=1.0->aiohttp->pymyq) (3.3) Installing collected packages: pymyq Attempting uninstall: pymyq Found existing installation: pymyq 3.1.4 Uninstalling pymyq-3.1.4: Successfully uninstalled pymyq-3.1.4 Successfully installed pymyq-3.1.5 bash-5.1#

bash-5.1# pip install --upgrade enocean Requirement already satisfied: enocean in /usr/local/lib/python3.10/site-packages (0.50.0) Collecting enocean Downloading enocean-0.60.1-py3-none-any.whl (25 kB) Requirement already satisfied: beautifulsoup4>=4.3.2 in /usr/local/lib/python3.10/site-packages (from enocean) (4.6.0) Requirement already satisfied: enum-compat>=0.0.2 in /usr/local/lib/python3.10/site-packages (from enocean) (0.0.3) Requirement already satisfied: pyserial>=3.0 in /usr/local/lib/python3.10/site-packages (from enocean) (3.5) Installing collected packages: enocean Attempting uninstall: enocean Found existing installation: enocean 0.50.0 Uninstalling enocean-0.50.0: Successfully uninstalled enocean-0.50.0 Successfully installed enocean-0.60.1

bash-5.1# pip install --upgrade MechanicalSoup Requirement already satisfied: MechanicalSoup in /usr/local/lib/python3.10/site-packages (0.12.0) Collecting MechanicalSoup Downloading MechanicalSoup-1.1.0-py3-none-any.whl (19 kB) Requirement already satisfied: requests>=2.22.0 in /usr/local/lib/python3.10/site-packages (from MechanicalSoup) (2.28.1) Collecting beautifulsoup4>=4.7 Using cached beautifulsoup4-4.11.1-py3-none-any.whl (128 kB) Requirement already satisfied: lxml in /usr/local/lib/python3.10/site-packages (from MechanicalSoup) (4.8.0) Requirement already satisfied: soupsieve>1.2 in /usr/local/lib/python3.10/site-packages (from beautifulsoup4>=4.7->MechanicalSoup) (2.3.2.post1) Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.10/site-packages (from requests>=2.22.0->MechanicalSoup) (1.26.11) Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/site-packages (from requests>=2.22.0->MechanicalSoup) (3.3) Requirement already satisfied: charset-normalizer<3,>=2 in /usr/local/lib/python3.10/site-packages (from requests>=2.22.0->MechanicalSoup) (2.1.0) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/site-packages (from requests>=2.22.0->MechanicalSoup) (2022.6.15) Installing collected packages: beautifulsoup4, MechanicalSoup Attempting uninstall: beautifulsoup4 Found existing installation: beautifulsoup4 4.6.0 Uninstalling beautifulsoup4-4.6.0: Successfully uninstalled beautifulsoup4-4.6.0 Attempting uninstall: MechanicalSoup Found existing installation: MechanicalSoup 0.12.0 Uninstalling MechanicalSoup-0.12.0: Successfully uninstalled MechanicalSoup-0.12.0 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. hangups 0.4.18 requires MechanicalSoup<0.13,>=0.6.0, but you have mechanicalsoup 1.1.0 which is incompatible. Successfully installed MechanicalSoup-1.1.0 beautifulsoup4-4.11.1 bash-5.1#

alandtse commented 1 year ago

https://pypi.org/project/pipdeptree/ may help

ajarillo1981 commented 1 year ago

I have tried pipdeptree but I don't see any package that requires specifically version 4.6 of beautifulsoup. Any other idea??

bash-5.1# pipdeptree -r --packages beautifulsoup4 Warning!!! Possibly conflicting dependencies found:

alandtse commented 1 year ago

I'm not sure. But I'm surprised that more of your integrations aren't breaking given you're not satisfying their dependencies.

ajarillo1981 commented 1 year ago

I really cannot understand these discrepancies if homeassistant is installed from an image as a container in hassio. I really would like to know if this happens to other users. In this point, I think that I have no options to use this integration on my installation. If somebody has any other suggestion, just let me know and I will try them.

ajarillo1981 commented 1 year ago

Issue was related with a custom component not updated, after updating I could update beautifulsoup and finnish the process. Thank you for pointing me in the right direction of the problem.

alandtse commented 1 year ago

Glad you were able to figure it out!