Giter VIP home page Giter VIP logo

Comments (20)

fft1010 avatar fft1010 commented on July 29, 2024 8

Can someone tell me, how to integrate the mentioned adjustments in my Win11 Python? I am not that good in python. Just installed this long time ago for trade republic. Thanks

Hi,
in the error it says somewhere at the end:

File "/usr/local/lib/python3.10/site-packages/pytr/api.py", line 279, in _get_ws
  raise ValueError(f'Connection Error: {response}')
ValueError: Connection Error: failed 29

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 = 22
or serach for this line, if it is not there. Than change the 22 to a 29 so that it looks like
connect_id = 29

save the file and start again. Worked for me, and a couple of others immediately.

thanks
Juergen

from pytr.

rhpl avatar rhpl commented on July 29, 2024 4

I had also the following error:

ValueError: Connection Error: failed 29

When 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

from pytr.

SixGunChief avatar SixGunChief commented on July 29, 2024 2

Can someone tell me, how to integrate the mentioned adjustments in my Win11 Python? I am not that good in python. Just installed this long time ago for trade republic. Thanks

Hi, in the error it says somewhere at the end:
[...schnipp...]
save the file and start again. Worked for me, and a couple of others immediately.

Well explained, even for beginners. Also worked for me immediately. Thank you from the sunny beach of the Baltic Sea.

from pytr.

parodev93 avatar parodev93 commented on July 29, 2024 1

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

from pytr.

hansgans007 avatar hansgans007 commented on July 29, 2024

Connecting to websocket ...
Traceback (most recent call last):
File "C:\Python39\Scripts\pytr-script.py", line 33, in
sys.exit(load_entry_point('pytr==0.1.5', 'console_scripts', 'pytr')())
File "C:\Python39\lib\site-packages\pytr\main.py", line 206, in main
asyncio.get_event_loop().run_until_complete(dl.dl_loop())
File "C:\Python39\lib\asyncio\base_events.py", line 641, in run_until_complete
return future.result()
File "C:\Python39\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:\Python39\lib\site-packages\pytr\utils.py", line 236, in get_next_timeline
await self.tr.timeline()
File "C:\Python39\lib\site-packages\pytr\api.py", line 443, in timeline
return await self.subscribe({'type': 'timeline', 'after': after})
File "C:\Python39\lib\site-packages\pytr\api.py", line 293, in subscribe
ws = await self._get_ws()
File "C:\Python39\lib\site-packages\pytr\api.py", line 279, in _get_ws
raise ValueError(f'Connection Error: {response}')
ValueError: Connection Error: failed 29

on me

windows 10
python3.9

from pytr.

GordonInDaHouse avatar GordonInDaHouse commented on July 29, 2024

Same here.

Login seems to work. But everything else results in "failed 29".

from pytr.

fft1010 avatar fft1010 commented on July 29, 2024

Hi,
Same here on Mac. I can confirm, that it worked yesterday morning (last download 11:13 german time and the days before) but than next time 13:13 (did a reboot, this is why I know the exact time) I wanted to use it yesterday, it did not work any more. Same errors as above. Did not change anything or update on the Mac in between.

thanks
Juergen

from pytr.

nospam999 avatar nospam999 commented on July 29, 2024

I have the same issue. Perhaps it has to do with the new traderepublic app that was recently launched ....?

from pytr.

GordonInDaHouse avatar GordonInDaHouse commented on July 29, 2024

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.

Working for me as well. Thanks for the solution!

from pytr.

G-Ultimatee avatar G-Ultimatee commented on July 29, 2024

Can someone tell me, how to integrate the mentioned adjustments in my Win11 Python?
I am not that good in python. Just installed this long time ago for trade republic.
Thanks

from pytr.

fft1010 avatar fft1010 commented on July 29, 2024

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.

Working for me as well. Thanks for the solution!

HI,
works here as well. Very easy, even no programmers can do the change, IMHO (I am non programmer :-) )

thanks a bunch
Juergen

from pytr.

mrdjv2 avatar mrdjv2 commented on July 29, 2024

Can someone tell me, how to integrate the mentioned adjustments in my Win11 Python? I am not that good in python. Just installed this long time ago for trade republic. Thanks

Hi, in the error it says somewhere at the end:

File "/usr/local/lib/python3.10/site-packages/pytr/api.py", line 279, in _get_ws
  raise ValueError(f'Connection Error: {response}')
ValueError: Connection Error: failed 29

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 = 22 or serach for this line, if it is not there. Than change the 22 to a 29 so that it looks like connect_id = 29

save the file and start again. Worked for me, and a couple of others immediately.

thanks Juergen

(base) C:\Users\xxx>pytr portfolio
17:44:40 Found credentials file
17:44:40 Phone: +49***********, PIN: ****
17:44:40 Web session resumed
17:44:40 Logged in
17:44:40 Connecting to websocket ...
17:44:40 Connected to websocket ...
17:44:40 Received error message: '1 E {"errors":[{"errorCode":"BAD_SUBSCRIPTION_TYPE","errorField":null,"errorMessage":"Unknown topic type","meta":{"source":"MAPPER"}}]}'
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Users\xxx\anaconda3\Scripts\pytr.exe_main
.py", line 7, in
File "C:\Users\xxx\anaconda3\Lib\site-packages\pytr\main.py", line 215, in main
Portfolio(login(phone_no=args.phone_no, pin=args.pin, web=not args.applogin)).get()
File "C:\Users\xxx\anaconda3\Lib\site-packages\pytr\portfolio.py", line 73, in get
asyncio.get_event_loop().run_until_complete(self.portfolio_loop())
File "C:\Users\xxx\anaconda3\Lib\asyncio\base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\xxx\anaconda3\Lib\site-packages\pytr\portfolio.py", line 16, in portfolio_loop
_subscription_id, subscription, response = await self.tr.recv()
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\xxx\anaconda3\Lib\site-packages\pytr\api.py", line 352, in recv
raise TradeRepublicError(subscription_id, subscription, payload)
pytr.api.TradeRepublicError: ('1', {'type': 'portfolio'}, {'errors': [{'errorCode': 'BAD_SUBSCRIPTION_TYPE', 'errorField': None, 'errorMessage': 'Unknown topic type', 'meta': {'source': 'MAPPER'}}]})

Changing 22 to 29 doesn't work for me... :-(

from pytr.

fft1010 avatar fft1010 commented on July 29, 2024

Can someone tell me, how to integrate the mentioned adjustments in my Win11 Python? I am not that good in python. Just installed this long time ago for trade republic. Thanks

Hi,
can you copy back the original "api.py" file, and send the error messages here? If it does show the "22" the given solution should work. If you have Windows, what might be the problem is, that the line ends are wrong, as windows has different line ends than unix. (Just an assumption, but I myself had this a couple of times.)

Try to download and install this editor

https://visualstudio.microsoft.com/de/downloads/

this recognizes the correct line ends IMHO also on windows. And use this editor for editing the api.py file.

thanks
Juergen

from pytr.

GordonInDaHouse avatar GordonInDaHouse commented on July 29, 2024

File "C:\Users\xxx\anaconda3\Lib\site-packages\pytr\api.py", line 352, in recv
raise TradeRepublicError(subscription_id, subscription, payload)
pytr.api.TradeRepublicError: ('1', {'type': 'portfolio'}, {'errors': [{'errorCode': 'BAD_SUBSCRIPTION_TYPE', 'errorField': None, 'errorMessage': 'Unknown topic type', 'meta': {'source': 'MAPPER'}}]})

Be careful. Don't mess up things.

We discuss here the problem with "ValueError: Connection Error: failed 29". This will get solved with changing the 21/22 to 29.

If you get an error with BAD_SUBSCRIPTION_TYPE, then this problem here is solved already. The portfolio is not available since they changed the API and will return this BAD_SUBSCRIPTION_TYPE error.

from pytr.

deka-xD avatar deka-xD commented on July 29, 2024

Hi,

The error “BAD_SUBSCRIPTION_TYPE” was solved with the miry fork version.
But I think the issue is back now.

Changing the ID to 29 solves the error for command “dl_docs”.

After this “Connection Error: failed 29” - , even with the fork version, doesn't work.

Can someone confirm this?

from pytr.

PhilippS93 avatar PhilippS93 commented on July 29, 2024

Hi,

The error “BAD_SUBSCRIPTION_TYPE” was solved with the miry fork version. But I think the issue is back now.

Changing the ID to 29 solves the error for command “dl_docs”.

After this “Connection Error: failed 29” - , even with the fork version, doesn't work.

Can someone confirm this?

Have you tried to install all dependencies again after editing the file? For me, it is working now.

from pytr.

deka-xD avatar deka-xD commented on July 29, 2024

Unfortunately, no. I changed the connect id and installed with this method again.

$ pip3 install .
$ pytr -v debug portfolio

But I am getting the same error as before.

from pytr.

fft1010 avatar fft1010 commented on July 29, 2024

Hi,

Can someone confirm this?

Hi,
I just tried:

pytr portfolio

and got

Received error message: '1 E {"errors":[{"errorCode":"BAD_SUBSCRIPTION_TYPE","errorField":null,"errorMessage":"Unknown topic type","meta":{"source":"MAPPER"}}]}'
Traceback (most recent call last):
  File "/usr/local/bin/pytr", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/pytr/main.py", line 215, in main
    Portfolio(login(phone_no=args.phone_no, pin=args.pin, web=not args.applogin)).get()
  File "/usr/local/lib/python3.10/site-packages/pytr/portfolio.py", line 73, in get
    asyncio.get_event_loop().run_until_complete(self.portfolio_loop())
  File "/usr/local/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.10/site-packages/pytr/portfolio.py", line 16, in portfolio_loop
    _subscription_id, subscription, response = await self.tr.recv()
  File "/usr/local/lib/python3.10/site-packages/pytr/api.py", line 352, in recv
    raise TradeRepublicError(subscription_id, subscription, payload)
pytr.api.TradeRepublicError: ('1', {'type': 'portfolio'}, {'errors': [{'errorCode': 'BAD_SUBSCRIPTION_TYPE', 'errorField': None, 'errorMessage': 'Unknown topic type', 'meta': {'source': 'MAPPER'}}]})

As I am not a programmer, I was happy, that the automated doc DL worked again with the "29", I never used anything else.

thanks
Juergen

from pytr.

deka-xD avatar deka-xD commented on July 29, 2024
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\xxxxx\AppData\Local\Programs\Python\Python312-arm64\Scripts\pytr.exe\__main__.py", line 7, in <module>
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python312-arm64\Lib\site-packages\pytr\main.py", line 215, in main
    Portfolio(login(phone_no=args.phone_no, pin=args.pin, web=not args.applogin)).get()
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python312-arm64\Lib\site-packages\pytr\portfolio.py", line 120, in get
    asyncio.get_event_loop().run_until_complete(self.portfolio_loop())
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python312-arm64\Lib\asyncio\base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\xxxxx\AppData\Local\Programs\Python\Python312-arm64\Lib\site-packages\pytr\portfolio.py", line 57, in portfolio_loop
    pos['netValue'] = response['last']['price'] * pos['netSize']
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
TypeError: can't multiply sequence by non-int of type 'str'

Still getting the frozen runpy error after debugging portfolio.

from pytr.

marzzzello avatar marzzzello commented on July 29, 2024

Fixed in latest version

from pytr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.