pytr-org / pytr

Use TradeRepublic in terminal and mass download all documents
https://pypi.org/project/pytr/
MIT License
390 stars 71 forks source link

No session resumption on different phone number #56

Open MartinScharrer opened 6 months ago

MartinScharrer commented 6 months ago

Added code to compare given phone number with the one in the credential file and disable websession resumption if so. For this to work well I also added a command line option to select if credentials should be saved or not. As a bonus a fix for corrupt cookie files got added.

This pull-request fixes https://github.com/marzzzello/pytr/issues/38.

MartinScharrer commented 6 months ago

Thanks for your PR. I can merge after the argument is changed to bool

Done.

I also now added support to credentials and cookies files arguments.

Katzmann1983 commented 3 months ago

Using the current code, it seems that the active session is not correctly reused:

pytr portfolio 15:41:45 Found credentials file 15:41:45 Phone: +346****, PIN: 15:41:45 Credentials not saved 15:41:45 Web session resumed 15:41:45 Logged in 15:41:45 Found credentials file 15:41:45 Phone: +346****, PIN: **** 15:41:45 Phone number different from credential files. Assuming different account. 15:41:45 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: 8415 15:42:11 Logged in 15:42:11 Connecting to websocket ... 15:42:12 Connected to websocket ...