Closed BastiR40 closed 1 year ago
Thanks for creating an issue! Could you add this at the beginning of your script and show the output:
import logging
logging.basicConfig()
logger = logging.getLogger("tibber")
logger.setLevel(logging.DEBUG)
Hi, i added the code snippet:-)
PS C:\Users\RotheS\Desktop> & C:/Users/RotheS/AppData/Local/Microsoft/WindowsApps/python3.7.exe c:/Users/RotheS/Desktop/srxtibber.py INFO:gql.transport.websockets:>>> {"type": "connection_init", "payload": {}} Traceback (most recent call last): File "c:/Users/RotheS/Desktop/srxtibber.py", line 1, in <module> import tibber File "c:\Users\RotheS\Desktop\tibber.py", line 55, in <module> asyncio.run(main()) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\asyncio\runners.py", line 43, in run return loop.run_until_complete(main) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 587, in run_until_complete return future.result() File "c:\Users\RotheS\Desktop\tibber.py", line 26, in main fetch_schema_from_transport=True, File "C:\Users\RotheS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\gql\client.py", line 658, in __aenter__ return await self.connect_async() File "C:\Users\RotheS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\gql\client.py", line 632, in connect_async await self.transport.connect() File "C:\Users\RotheS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\gql\transport\websockets_base.py", line 514, in connect raise e File "C:\Users\RotheS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\gql\transport\websockets_base.py", line 512, in connect await self._initialize() File "C:\Users\RotheS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\gql\transport\websockets.py", line 152, in _initialize await self._send_init_message_and_wait_ack() File "C:\Users\RotheS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\gql\transport\websockets.py", line 149, in _send_init_message_and_wait_ack await asyncio.wait_for(self._wait_ack(), self.ack_timeout) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\asyncio\tasks.py", line 442, in wait_for return fut.result() File "C:\Users\RotheS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\gql\transport\websockets.py", line 124, in _wait_ack init_answer = await self._receive() File "C:\Users\RotheS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\gql\transport\websockets_base.py", line 231, in _receive data: Data = await self.websocket.recv() File "C:\Users\RotheS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\websockets\legacy\protocol.py", line 568, in recv await self.ensure_open() File "C:\Users\RotheS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\websockets\legacy\protocol.py", line 953, in ensure_open raise self.connection_closed_exc() websockets.exceptions.ConnectionClosedError: received 4500 (private use) Internal server error; then sent 4500 (private use) Internal server error
Can you see any hint of the Problem, i´ve heard from a lot of other Forums and Thread that the websocket is buggy.. THX and hope to hear from you. BastiR
Thanks! I'm really not sure why you're receiving this error, but I'm also surprised that your code runs with Python 3.7. I thought tibber.py only supported version 3.9 and up. Could you try upgrading your Python version to Python 3.9, 3.10 or 3.11 and see if the error persists?
Hi, i fixed it by my self... Problem is the used path to the gql-socket:
wss://websocket-api.tibber.com/v1-beta/gql/subscriptions
is the right one:-)
Describe the bug
I constantly getting this ErrorCode: websockets.exceptions.ConnectionClosedError: received 4500 (private use) Internal server error; then sent 4500 (private use) Internal server error
I´ve checked the Token several times, and in the API-Explorer erverything works fine:-) Tibber Support can´t help..
To Reproduce
import tibber
account = tibber.Account(tibber.DEMO_TOKEN) # Log in with an access token. All information gets updated here and stored in cache.
These properties are retrieved from cache and DO NOT reflect data at the given time
(but rather the data as it was when it last was cached)
print(account.name) # "Arya Stark" print(account.user_id) # "dcc2355e-6f55-45c2-beb9-274241fe450c" print(account.account_type) # ["tibber", "customer"] print(account.login) # "arya@winterfell.com"
To update the cache with new data straight from the tibber api, run this:
account.update()
Now use the updated data as you would before:
print(account.name)
Full error / traceback here
PS C:\Users\RotheS\Desktop> & C:/Users/RotheS/AppData/Local/Microsoft/WindowsApps/python3.10.exe c:/Users/RotheS/Desktop/srxtibber.py INFO:gql.transport.websockets:>>> {"type": "connection_init", "payload": {}} Traceback (most recent call last): File "c:\Users\RotheS\Desktop\srxtibber.py", line 1, in
import tibber
File "c:\Users\RotheS\Desktop\tibber.py", line 55, in
asyncio.run(main())
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64qbz5n2kfra8p0\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64qbz5n2kfra8p0\lib\asyncio\base_events.py", line 649, in run_until_complete
return future.result()
File "c:\Users\RotheS\Desktop\tibber.py", line 24, in main
async with Client(
File "C:\Users\RotheS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gql\client.py", line 658, in aenter
return await self.connect_async()
File "C:\Users\RotheS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gql\client.py", line 632, in connect_async
await self.transport.connect()
File "C:\Users\RotheS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gql\transport\websockets_base.py", line 514, in connect
raise e File "C:\Users\RotheS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gql\transport\websockets_base.py", line 512, in connect
await self._initialize() File "C:\Users\RotheS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gql\transport\websockets.py", line 152, in _initialize
await self._send_init_message_and_wait_ack() File "C:\Users\RotheS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gql\transport\websockets.py", line 149, in _send_init_message_and_wait_ack await asyncio.wait_for(self._wait_ack(), self.ack_timeout) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\asyncio\tasks.py", line 445, in wait_for return fut.result() File "C:\Users\RotheS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gql\transport\websockets.py", line 124, in _wait_ack
init_answer = await self._receive() File "C:\Users\RotheS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gql\transport\websockets_base.py", line 231, in _receive
data: Data = await self.websocket.recv() File "C:\Users\RotheS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\websockets\legacy\protocol.py", line 568, in recv await self.ensure_open() File "C:\Users\RotheS\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\websockets\legacy\protocol.py", line 953, in ensure_open
raise self.connection_closed_exc() websockets.exceptions.ConnectionClosedError: received 4500 (private use) Internal server error; then sent 4500 (private use) Internal server error PS C:\Users\RotheS\Desktop>
Expected behavior
get DEMO data an connerction up and running
Version
latest Version tibber.py