pytr-org / pytr

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

Re-subscribe in case of an error from Trade Republic #133

Closed RealCLanger closed 3 weeks ago

RealCLanger commented 1 month ago

Hi,

this should fix an issue that was initially reported in #109.

When downloading large numbers of timeline events, some subscriptions might yield errors. Such as shown in the logs: Received error message: '829 E {"errors":[{"errorCode":"UNKNOWN_ERROR","errorField":null,"errorMessage":"Could not process response","meta":{"source":"MAPPER"}}]}'

I guess formerly it caused the downloading not to return at all. This endless waiting seems to have been fixed in 2f62b098e8e339f8bcfe65177adeb46a6b05efdd. However, this only makes pytr return at the cost of adding some double transactions in the resulting account_transactions.csv while leaving out the transactions where data retrieval from TR failed, because the loop in DL.dl_loop() is not broken up but rather feeded with the previous response.

This should fix it by re-registering failed subscriptions. In my case I now get consistent transaction files when downloading my whole history.