pytr-org / pytr

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

Unkown_Error on download documents #36

Closed kellerkind87 closed 2 days ago

kellerkind87 commented 1 year ago

Hi, recently i face the following error situation during the download of documents

pytr dl_docs --last_days 60 "C:\docs_downloaded"

21:31:15 Received error message: '1 E {"errors":[{"errorCode":"UNKNOWN_ERROR","errorField":null,"errorMessage":"Unknown error","meta":{"source":"PLATFORM"}}]}'
21:31:15 ('1', {'type': 'timeline', 'after': None}, {'errors': [{'errorCode': 'UNKNOWN_ERROR', 'errorField': None, 'errorMessage': 'Unknown error', 'meta': {'source': 'PLATFORM'}}]})
Traceback (most recent call last):
  File "c:\python38\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\python38\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Python38\Scripts\pytr.exe\__main__.py", line 7, in <module>
  File "c:\python38\lib\site-packages\pytr\main.py", line 206, in main
    asyncio.get_event_loop().run_until_complete(dl.dl_loop())
  File "c:\python38\lib\asyncio\base_events.py", line 612, in run_until_complete
    return future.result()
  File "c:\python38\lib\site-packages\pytr\dl.py", line 67, in dl_loop
    if subscription['type'] == 'timeline':
UnboundLocalError: local variable 'subscription' referenced before assignment

login is successfully and querying the portfolio is working. Maybe they changed sth on their api. How can this be solved?

BG.

kellerkind87 commented 1 year ago

Seems like sometimes the result by TR is not reliable... after waiting some time and doing some retries it worked...

-> maybe implement some retry?