itsjafer / schwab-api

A python library for placing trades on Charles Schwab
MIT License
201 stars 64 forks source link

Response 413 error in get_account_info_v2() #28

Closed QingqiLei closed 8 months ago

QingqiLei commented 8 months ago

Hi, get_account_info returns info for the selected account, not all accounts. So, I try to use get_account_info_v2, but the response is always 413. Does anyone else meet this issue?

WinesProof commented 8 months ago

I don't get this error now, but HTTP error code 413 is "Request Entity Too Large", which I reported in #20. The fix in that case was to remove the 'ADRUM_BT1' and 'ADRUM_BTa' cookies prior to the request that failed. Jafer added this to the beginning of the update_token method, which gets called at the beginning of get_account_info_v2, but if the token update re-creates those cookies, we might need to remove them again before the http request in get_account_info_v2.

I can't reproduce your error, though, so I can't try it myself. Can you try?

cnMuggle commented 8 months ago

I think I saw this error before. I comment out update_token() in get_account_info_v2 and re-login again to bypass it. This issue only happens when the program continues request data from the API, not failed all the time.

QingqiLei commented 8 months ago

After removing update_token() in get_account_info_v2(), it works. Thanks