pyrh: Login Errors with 2FA (email code)
Checklist
- [ x] I am on the latest pyrh version.
- [ x] I have searched the issues of this repo and believe that this is not a duplicate.
Description
Getting an error when trying to log in following instructions on quickstart, prompts for a 2FA email code and I enter the SMS code which fails to work
Steps/Code to Reproduce
import config
robinhood = Robinhood()
robinhood.login(username= config.username, password= config.password)
quote = robinhood.quote_data("TWTR")
print(quote)
Results
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/pyrh/robinhood.py", line 215, in login
res2.raise_for_status()
File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 941, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.robinhood.com/challenge//respond/
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "trade.py", line 6, in <module>
robinhood.login(username= config.username, password= config.password)
File "/usr/local/lib/python3.7/site-packages/pyrh/robinhood.py", line 228, in login
raise RH_exception.LoginFailed()
pyrh.exceptions.LoginFailed
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 30 (2 by maintainers)
Ok, I think I figured out the issue! 🎉
In the constructor for
Robinhood.login()there is a keyword argumentchallenge_type. The default isemail. Change this to whatever 2FA format you prefer. I’m not sure what all the available options are (not really documented anywhere) but I changed mine tosmsand it worked.Here’s an example below.
You should receive your 2FA code via SMS - enter it and it should return
True.Note I don’t have 2FA turned on in my Robinhood app settings.
Hope this helps!
Sorry everyone for leaving y’all hanging! I’ve been busy lately with other projects. I’ll do more research into this
Closed by v2.0.1 release
Yo @Jamonek – The latest PYPI release is just old – you can re-release it should fix the issues. Thanks so much!! This is an awesome project!
@alexandrepdumont done, check https://github.com/HenryFBP/robinhoodtest. It should work finally…
I hope the maintainers of this package see this thread and decide to finally make a new release, or automate their releases…I may end up doing that myself if this proves useful for stock trading and then just submit a pull request.
Yes…let’s hope not XD
Anyways, Poetry can pull from PyPI (
poetry add pyrhhfbp) or using Git URLs. Check thepyproject.tomlfile for how to do either.@alexandrepdumont I am working on releasing the latest build of
pyrhto PyPI – check https://github.com/HenryFBP/robinhoodtest/blob/master/pyproject.toml line 10 for the new version, I am about to upload itYou sir are a coding genius I’ll try this latest solution and get back to you.
On Sun, Apr 17, 2022, 11:37 Henry Post @.***> wrote: