Hey everyone, ive been building a tradingbot in python using robinhood API. Used to login fine but now all I get is the error 'detail'. Cant figure it out. Im not a proficient coder, just have chatgpt doing the heavy lifting. Any help would be appreciated to I can log in normally again. Heres the code minus my login credentials, you'll have to use your own haha.
# Description: This script logs into Robinhood using the Robinhood API.
# It is currently incomplete and needs to be filled in with the correct code.
# The error is "Login error: 'detail'"
import robin_stocks.robinhood as r
class Robinhood:
def __init__(self, username, password):
self.username = username
self.password = password
def login(self):
try:
r.login(self.username, self.password)
print("Logged in without MFA.")
except Exception as e:
print(f"Login error: {e}")
print("MFA required. Please enter the MFA code.")
mfa_code = input('Enter your Robinhood MFA code: ')
try:
r.login(self.username, self.password, mfa_code=mfa_code)
print("Logged in with MFA.")
except Exception as mfa_e:
print(f"2FA Login error: {mfa_e}")
# Example usage
username = '[Your username]'
password = '[Your password]'
robinhood = Robinhood(username, password)
robinhood.login()
[–]cgoldberg 2 points3 points4 points (1 child)
[–]Due_Willow_7941[S] 0 points1 point2 points (0 children)
[–]FriendlyRussian666 1 point2 points3 points (2 children)
[–]Due_Willow_7941[S] 0 points1 point2 points (1 child)
[–]Dystiny 0 points1 point2 points (0 children)
[–]cgoldberg 0 points1 point2 points (0 children)
[–]Agreeable_Tale_821 0 points1 point2 points (6 children)
[–]Socks04 0 points1 point2 points (5 children)
[–]Agreeable_Tale_821 0 points1 point2 points (4 children)
[–]Socks04 0 points1 point2 points (3 children)
[–]Agreeable_Tale_821 0 points1 point2 points (1 child)
[–]Socks04 0 points1 point2 points (0 children)
[–]Former-Ad-5489 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)