Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup issue- synchronous HTTP calls #4

Open
philipohagan opened this issue Feb 24, 2025 · 0 comments
Open

Setup issue- synchronous HTTP calls #4

philipohagan opened this issue Feb 24, 2025 · 0 comments

Comments

@philipohagan
Copy link

Hi! Thanks for building this - I got the below error on my home assistant install - running Home Assistant Core 2025.2.3

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:738
integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 22:16:48 (3 occurrences)
Last logged: 22:21:27

thames_water: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 738, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1318, in async_device_update
    await self.async_update()
  File "/config/custom_components/thames_water/sensor.py", line 165, in async_update
    thames_water = ThamesWater(email=self._username, password=self._password, account_number=self._account_number)
  File "/usr/local/lib/python3.13/site-packages/thameswaterclient.py", line 57, in __init__
    self._authenticate(email, password)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/thameswaterclient.py", line 205, in _authenticate
    trans_token, csrf_token = self._authorize_b2c_1_tw_website_signin()
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/thameswaterclient.py", line 80, in _authorize_b2c_1_tw_website_signin
    r = self.s.get(url, params=params)
  File "/usr/local/lib/python3.13/site-packages/requests/sessions.py", line 602, in get
    return self.request("GET", url, **kwargs)
           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.13/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.13/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
        method=request.method,
    ...<9 lines>...
        chunked=chunked,
    )
  File "/usr/local/lib/python3.13/site-packages/urllib3/connectionpool.py", line 716, in urlopen
    httplib_response = self._make_request(
        conn,
    ...<5 lines>...
        chunked=chunked,
    )
  File "/usr/local/lib/python3.13/site-packages/urllib3/connectionpool.py", line 416, in _make_request
    conn.request(method, url, **httplib_request_kw)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/urllib3/connection.py", line 244, in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/http/client.py", line 1336, in request
    self._send_request(method, url, body, headers, encode_chunked)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/http/client.py", line 1347, in _send_request
    self.putrequest(method, url, **skips)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/urllib3/connection.py", line 219, in putrequest
    return _HTTPConnection.putrequest(self, method, url, *args, **kwargs)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 193, in protected_loop_func
    raise_for_blocking_call(
    ~~~~~~~~~~~~~~~~~~~~~~~^
        func,
        ^^^^^
    ...<4 lines>...
        kwargs=kwargs,
        ^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 159, in raise_for_blocking_call
    raise RuntimeError(
    ...<8 lines>...
    )
RuntimeError: Caught blocking call to putrequest with args (<urllib3.connection.HTTPSConnection object at 0x7f4a82f4d0>, 'GET', '/identity.thameswater.co.uk/b2c_1_tw_website_signin/oauth2/v2.0/authorize?client_id=cedfde2d-79a7-44fd-9833-cae769640d3d&scope=openid+profile+offline_access&response_type=code&redirect_uri=https%3A%2F%2Fwww.thameswater.co.uk%2Flogin&response_mode=fragment&code_challenge=zw4TW9ML-n7R-8dEM-GxHz_cjdBDMt_e8WC5Z8d2qxE&code_challenge_method=S256&nonce=43115a86-0639-41a7-b6b8-5aebad07e5a8&state=a0ba4c07-c55d-4e29-b4f5-b8e520d097b4') inside the event loop by custom integration 'thames_water' at custom_components/thames_water/sensor.py, line 165: thames_water = ThamesWater(email=self._username, password=self._password, account_number=self._account_number). (offender: /usr/local/lib/python3.13/site-packages/urllib3/connection.py, line 219: return _HTTPConnection.putrequest(self, method, url, *args, **kwargs)), please create a bug report at hhttps://github.com/ale770/ha-thames-water/issues
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#putrequest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant