Chavithra / degiro-connector

This is yet another library to access Degiro's API.
BSD 3-Clause "New" or "Revised" License
205 stars 46 forks source link

ConnectionError: 400 Client Error: Bad Request for url: https://trader.degiro.nl/login/secure/login #107

Closed MPrazzoli closed 6 months ago

MPrazzoli commented 1 year ago

I got this message when I run the client_details_table.py and I got the {"status":1,"statusText":"error"} when I run the url: https://trader.degiro.nl/login/secure/login in the browser. It seems like that url doesn't work.

JerBouma commented 1 year ago

Seems to be caused by DEGIRO's new policy blocking the default request. Issue was also discussed (and solved) here: https://github.com/lolokraus/DegiroAPI/issues/61.

123m321 commented 1 year ago

Thanks, will dive into this because it suddenly started on 29 december. Although I get error 429.

How and where can I apply the work around? I'm used to my own code, but adjusting the source code here is another story.

JerBouma commented 1 year ago

@Chavithra Can you take a peek?

123m321 commented 1 year ago

This is my log, it gives the 429 error. However, it worked flawless until 29 december. And I added a lot of 1 second sleep moments, so that cant be the source of the problem.

Often my script works for a few minutes, and then fails. If I try to restart immediately, it won't start as it stops at getting the data from the exchange.

edit: i just upgraded the degiro_connector.. maybe this was all I needed to do

trading_api.connect()
File "/home/ubuntu/.local/lib/python3.9/site-packages/degiro_connector/core/abstracts/abstract_action.py", line 72, in __call__
return self.call(*args, **kwargs)
File "/home/ubuntu/.local/lib/python3.9/site-packages/degiro_connector/trading/actions/action_connect.py", line 121, in call
connection_storage.session_id = self.get_session_id(
File "/home/ubuntu/.local/lib/python3.9/site-packages/degiro_connector/trading/actions/action_connect.py", line 102, in get_session_id
raise ConnectionError(e)
ConnectionError: 429 Client Error: Too Many Requests for url: https://trader.degiro.nl/login/secure/login/totp
123m321 commented 1 year ago

Unfortunately the issue persists. I get kicked out after a few minutes.

123m321 commented 1 year ago

I solved the 429 error (it used to be possible to login multiple times at the same time), but now I get the 401 error. Which is the same as the 400 issue, only difference seems to be the 2FA.

A work around would be great, @Chavithra did you have time to see where the problem is?

2023-01-09 11:57:01,025 | degiro_connector.trading.actions.action_get_update | CRITICAL | error
13579 2023-01-09 11:57:01,026 | degiro_connector.trading.actions.action_get_update | CRITICAL | <Response [401]>
13580 2023-01-09 11:57:01,026 | degiro_connector.trading.actions.action_get_update | CRITICAL | 401 Client Error: Non-Autorisé for url: https://trader.degiro.nl/trading/secure/v5/update/1634822;jsessionid      =44A930849362491E723CD849241B0C6E.prod_a_111_4?orders=0&portfolio=0&totalPortfolio=0&intAccount=888888&sessionId=44A930849362491E723CD849241B0C6E.prod_a_111_4
13581 2023-01-09 11:57:01,026 | root | CRITICAL | Unhandled exception
Chavithra commented 6 months ago

Hello folks,

I guess this was fixed in the 2.0.23 from January 12th 2023 or later version since the library is working currently.

Closing this issue for now.

Feel free to reopen it for further update.

Thanks