Closed qtcwt closed 3 years ago
Same issue here. I have to login twice and then it will load after sending an SMS authentication for a second time.
@fjehlik @AlgoTrader1234
Did you try my solution? If you could locate where robin_stocks is installed and replace this line of request_get(portfolio_profile_url(), 'regular', payload, jsonify_data=False)
with request_get(positions_url(), 'pagination', {'nonzero': 'true'},jsonify_data=False)
, would the issue disappear?
I'm going to create a pull request later.
@qtcwt, thank you for the follow up. I am trying to find the robinstocks folder on my Mac to make the change (no luck finding where the pip install robin_stocks puts the package folder on the Mac yet so that the change can be made). Once that is figured out I will make the change and update~
@qtcwt, I found where the mac stores the authentication.py file, made the same change, rebooted Anaconda and logged in. I received the same error. However, like I before, if I log in a second time then it works (after the first pickle error).
@fjehlik I would suggest you to add one print
around the changes to the authentication.py, just to make sure it's really using the changed code.
If the change indeed takes effect but the same error remains, I guess the issue is somewhere else. I located my issue by debugging on vscode. You can set "justMyCode": false
in launch.json and set a breakpoint in authentication.py to see what exactly goes wrong. Hope this helps.
@AlgoTrader1234 @fjehlik
When I was trying to configure the environment on a server, I realized that there can be two authentication.py
in site-packages/robin_stocks
. The one I've been referring to is site-packages/robin_stocks/robinhood/authentication.py
, while there is another perhaps obsolete one site-packages/robin_stocks/authentication.py
. Please double check you are changing the right one.
On the other hand, like I shared in the last comment, you can verify whether your change really takes effect by adding one line of print
to print out something random.
@qtcwt this worked for me! Thank you!
@qtcwt, thank you again for all the follow up it is greatly appreciated. I had changed the authentication.py file in the other folder, however, made the change you recommended and also included a print statement to verify it was the correct file. I still have the issue... it's more of a hassle than anything else as I can get it to work, I always just have to login a second time after getting the error and then the second time I enter the SMS code they send the second time it works.
Every time I tried to log in with pickle, it fails and prints
ERROR: There was an issue loading pickle file. Authentication may be expired - logging in normally.
No matter how long the login interval is.By looking into the code, I found that this line of
request_get(portfolio_profile_url(), 'regular', payload, jsonify_data=False)
always returns 401, even immediately after I freshly log in successfully without a pickle file. I guess this API of getting portfolio profile is broken/inaccessible for my account/requiring additional verification?My workaround for now is to get some other info, such as my position info, to verify if the session is still valid. I replaced the above line with
request_get(positions_url(), 'pagination', {'nonzero': 'true'},jsonify_data=False)
.