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

get_update() Error 403 #124

Closed N214 closed 6 months ago

N214 commented 6 months ago

No 2FA.

    logging.basicConfig(level=logging.DEBUG)
    credentials = Credentials(
        username=os.environ.get("DEGIRO_USERNAME"),
        password=os.environ.get("DEGIRO_PASSWORD"),
    )
    trading_api = TradingAPI(credentials=credentials)
    trading_api.connect()

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

    update = trading_api.get_update(request_list=request_list)
DEBUG:degiro_connector.core.models.model_session:session:getter: MainThread
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): trader.degiro.nl:443
DEBUG:urllib3.connectionpool:https://trader.degiro.nl:443 "POST /login/secure/login HTTP/1.1" 200 None
INFO:degiro_connector.trading.actions.action_connect:get_session_id:response_dict: {'isPassCodeEnabled': True, 'locale': 'nl_NL', 'redirectUrl': 'https://trader.degiro.nl/trader/', 'sessionId': 'SESSONID.prod_dcv_ch61_1', 'status': 0, 'statusText': 'success'}
DEBUG:degiro_connector.core.models.model_session:session:getter: MainThread
DEBUG:urllib3.connectionpool:https://trader.degiro.nl:443 "GET /trading/secure/v5/update/0;jsessionid=SESSONID.prod_dcv_ch61_1?totalPortfolio=0&intAccount=0&sessionId=SESSONID.prod_dcv_ch61_1 HTTP/1.1" 403 None
CRITICAL:degiro_connector.trading.actions.action_get_update:error
CRITICAL:degiro_connector.trading.actions.action_get_update:<Response [403]>
CRITICAL:degiro_connector.trading.actions.action_get_update:403 Client Error:  for url: https://trader.degiro.nl/trading/secure/v5/update/0;jsessionid=SESSONID.prod_dcv_ch61_1?totalPortfolio=0&intAccount=0&sessionId=SESSONID.prod_dcv_ch61_1

Anyone had this issue?

N214 commented 6 months ago

Solved, need to get int_account first with get_client_details then use int_account in the credentials before calling get_update

    credentials = Credentials(
        username=os.environ.get("DEGIRO_USERNAME"),
        password=os.environ.get("DEGIRO_PASSWORD"),
        int_account=12345
    )