pytr: ValueError: Connection Error: failed 29 Segmentation fault after dl_docs
Description of the bug After trying to download documents via dl_docs im getting following error:
Error log $ pytr -v debug dl_docs . 2023-10-02 20:43:21+0200 main DEBUG logging is set to debug 2023-10-02 20:43:21+0200 account INFO Found credentials file 2023-10-02 20:43:21+0200 account INFO Phone: ********, PIN: **** 2023-10-02 20:43:21+0200 account INFO Web session resumed 2023-10-02 20:43:21+0200 account INFO Logged in 2023-10-02 20:43:21+0200 dl INFO Found 419 lines in history file 2023-10-02 20:43:21+0200 utils INFO Awaiting timeline 2023-10-02 20:43:21+0200 api INFO 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\xxxxxx\AppData\Local\Programs\Python\Python311\Scripts\pytr.exe_main.py", line 7, in <module> File “C:\Users\xxxxxx\AppData\Local\Programs\Python\Python311\Lib\site-packages\pytr\main.py”, line 206, in main asyncio.get_event_loop().run_until_complete(dl.dl_loop()) File “C:\Users\xxxxxx\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py”, line 653, in run_until_complete return future.result() File “C:\Users\xxxxxx\AppData\Local\Programs\Python\Python311\Lib\site-packages\pytr\dl.py”, line 59, in dl_loop await self.tl.get_next_timeline(max_age_timestamp=self.since_timestamp) File “C:\Users\xxxxxx\AppData\Local\Programs\Python\Python311\Lib\site-packages\pytr\utils.py”, line 236, in get_next_timeline await self.tr.timeline() File “C:\Users\xxxxxx\AppData\Local\Programs\Python\Python311\Lib\site-packages\pytr\api.py”, line 443, in timeline return await self.subscribe({‘type’: ‘timeline’, ‘after’: after}) File “C:\Users\xxxxxx\AppData\Local\Programs\Python\Python311\Lib\site-packages\pytr\api.py”, line 293, in subscribe ws = await self._get_ws() File “C:\Users\xxxxxx\AppData\Local\Programs\Python\Python311\Lib\site-packages\pytr\api.py”, line 279, in _get_ws raise ValueError(f’Connection Error: {response}') ValueError: Connection Error: failed 29 Segmentation fault
To Reproduce Steps to reproduce the behavior:
Ran the command pytr dl_docs .
Environment
- Windows 10
- pytr version:
0.0.15
Additional context Tried python 3.7 python 3.9 and python 3.11 It seems that after the Trade Repbulic update they changed the API?!
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Comments: 20 (2 by maintainers)
Hi, in the error it says somewhere at the end:
which gives you the path where the api.py file is sitting. Make a copy of this file api.py file, if the following does not work Take an editor (notepad, vi, … NOT WORD) and edit this api.py (original, not copy). Go to line 272 in this file. You should see something like:
connect_id = 22or serach for this line, if it is not there. Than change the 22 to a 29 so that it looks likeconnect_id = 29save the file and start again. Worked for me, and a couple of others immediately.
thanks Juergen
I had also the following error:
ValueError: Connection Error: failed 29When you look in the traceback it points to api.py:249
Since the error is regarding the websocket connect function i looked in the devtools for the webapplication of TR. There it said it connects on 28 - Atleast for me…
So back to the api.py file. A littlebit over the error line (line 272) you find
connect_id = 22. I tried to change it to 29 since this is what the error said. Result is it worked after saving the file.I also tried 28 and 24, which also worked… It just didnt work for 21 or 22. So I dont exactly know why those numbers are not working but i think something changed on TR side.
I would have done a change request or smth… but i have never done this. Maybe someone smarter who is reading this can take over from here on.
Greetings
Well explained, even for beginners. Also worked for me immediately. Thank you from the sunny beach of the Baltic Sea.
Good finding. Once i have checked it i will do a PR. Is this repo still be maintained? As i can still see old PRs which doesnt be merged yet i guess no one gona merge mine. Lets see, at least we have a solution.
Edit: after testing worked fine with id 29 PR Connection Error: failed 29 #43