Open malinazakat opened 1 week ago
I had the same error running this command on my Mac with Python 3.12.4. Could solve this issue by running the program in a virtual python 3.9 environment (see #141).
Tried with Python 3.13 and now got slightly different error
20:19:36 Logged in
20:19:36 Created history file
20:19:36 Subscribing to #1 timeline transactions
20:19:36 Connecting to websocket ...
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "c:\users\ali\.local\bin\pytr.exe\__main__.py", line 7, in <module>
sys.exit(main())
~~~~^^
File "C:\Users\Ali\pipx\venvs\pytr\Lib\site-packages\pytr\main.py", line 266, in main
asyncio.get_event_loop().run_until_complete(dl.dl_loop())
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "C:\Users\Ali\AppData\Local\Programs\Python\Python313\Lib\asyncio\base_events.py", line 721, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "C:\Users\Ali\pipx\venvs\pytr\Lib\site-packages\pytr\dl.py", line 68, in dl_loop
await self.tl.get_next_timeline_transactions()
File "C:\Users\Ali\pipx\venvs\pytr\Lib\site-packages\pytr\timeline.py", line 30, in get_next_timeline_transactions
await self.tr.timeline_transactions()
File "C:\Users\Ali\pipx\venvs\pytr\Lib\site-packages\pytr\api.py", line 506, in timeline_transactions
return await self.subscribe({"type": "timelineTransactions", "after": after})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ali\pipx\venvs\pytr\Lib\site-packages\pytr\api.py", line 322, in subscribe
ws = await self._get_ws()
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ali\pipx\venvs\pytr\Lib\site-packages\pytr\api.py", line 301, in _get_ws
self._ws = await websockets.connect(
^^^^^^^^^^^^^^^^^^^^^^^^^
"wss://api.traderepublic.com", ssl=ssl_context, extra_headers=extra_headers
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\Ali\pipx\venvs\pytr\Lib\site-packages\websockets\asyncio\client.py", line 441, in __await_impl__
self.connection = await self.create_connection()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ali\pipx\venvs\pytr\Lib\site-packages\websockets\asyncio\client.py", line 367, in create_connection
_, connection = await loop.create_connection(factory, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
TypeError: BaseEventLoop.create_connection() got an unexpected keyword argument 'extra_headers'
Did not work for me with Python 3.9.13 either.
I asked ChatGPT for help, and it suggested downgrading the WebSockets version:
pip install websockets==10.2
Took me also some time to get Python 3.9 running in a virtual environment (venv).
Thanks a lot. worked for me too with the downgraded websockets version.
same here worked after downgrading websockets
Just for others, not sure if that is the best solution but it works for me, didn't work much with python yet:
pipx reinstall pytr --python /opt/homebrew/bin/python3.9
pipx inject pytr websockets==10.2 --force
Just for others, what worked for me under Windows 11 --> open "Eingabeauforderung" (search "cmd")
Description of the bug I am getting the following error in multiple commands.
To Reproduce Steps to reproduce the behavior:
Expected behavior Files to be downloaded.
Error log 2024-11-10 16:56:38+0100 main DEBUG logging is set to debug 2024-11-10 16:56:38+0100 account INFO Credentials file not found Please enter your TradeRepublic phone number in the format +4912345678: xxx Please enter your TradeRepublic pin: Pin (Input is hidden): xxx Save credentials? Type "y" to save credentials:
2024-11-10 16:56:41+0100 account INFO Credentials not saved Enter the code you received to your mobile app as a notification. Enter nothing if you want to receive the (same) code as SMS. (Countdown: 31) Code: xxx 2024-11-10 16:56:46+0100 account INFO Logged in 2024-11-10 16:56:46+0100 dl INFO Created history file 2024-11-10 16:56:46+0100 timeline INFO Subscribing to #1 timeline transactions 2024-11-10 16:56:46+0100 api INFO Connecting to websocket ...
Environment