Chavithra / degiro-connector

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

various requests return http 403/404 #3

Closed paveldomsa closed 3 years ago

paveldomsa commented 3 years ago

Hi, I can successfully log in and get config table via trading_api.get_config(). Returned data seems to be ok. Since that nothing works as expected. For example: favourites_list = trading_api.get_favourites_list() results in: DEBUG:urllib3.connectionpool:https://trader.degiro.nl:443 "GET /pa/secure/favourites/lists?intAccount=1536831&sessionId=384815D9922F04E8EB92614449202A7B.prod_b_113_2 HTTP/1.1" 404 None CRITICAL:trading.basic:404 CRITICAL:trading.basic:{"errors":[{"text":"No corresponding resource found"}]} CRITICAL:trading.basic:'data' False

next: request_list = Update.RequestList() request_list.values.extend( [ Update.Request( option=Update.Option.TOTALPORTFOLIO, last_updated=0, ), ] ) print (request_list)

update = trading_api.get_update(request_list=request_list, raw=False) update_dict = pb_handler.message_to_dict(message=update)

results in: DEBUG:urllib3.connectionpool:https://trader.degiro.nl:443 "GET /trading/secure/v5/update/1535031;jsessionid=AEE095C89F409EE4569DCA2829EF16B1.prod_b_113_2?totalPortfolio=0&intAccount=1535031&sessionId=AEE095C89F409EE4569DCA2829EF16B1.prod_b_113_2 HTTP/1.1" 403 None {'response_datetime': '2021-01-25T13:41:56.123899Z'}

Any ideas, thanks?

Chavithra commented 3 years ago

Hello there,

I have split my answer into five parts :

  1. Credentials in your message
  2. Good news
  3. Bad news
  4. One way I have reproduced this issue
  5. Question

1. Credentials in your message There is a "intAccount" in your message.

If this is your personal "intAccount", it would be better to remove it from the message and then remove the history of modification.

2. Good news The methods "get_favourites_list" and "get_update" are working on my side.

I have run the examples from the library and I have the right results.

3. Bad news This probably means the issue is on the test you made.

4. One way I have reproduced this issue I might have spotted the issue : when I use the wrong "intAccount" I have the same errors (404 and 403).

5. Question Can you tell me how you get your "intAccount" ?

Thanks

paveldomsa commented 3 years ago

Thanks for quick response. Here is how i get it: config_table = trading_api.get_config() user_token = config_table['clientId']

Chavithra commented 3 years ago

Ok, I understand now.

Issue The "user_token" was used instead of the "int_account".

These two identifiers are not the same thing :

Solution One way to get the "int_account" is to use the method : "get_client_details".

More information about how to get the "int_account" is available in the documentation of this library.

P.S. : I think the "int_account" you have used is still in the second part of the logs (logs for "get_update"), maybe replace that too ?

Hope that helps

paveldomsa commented 3 years ago

it helped. thanks.