Skip to content

Commit

Permalink
Updated Login()
Browse files Browse the repository at this point in the history
  • Loading branch information
aamazie authored May 6, 2019
1 parent 5ec6a52 commit 9343f8b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Robinhood/Robinhood.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ def login(self,
res = self.session.post(endpoints.login(), data=payload, timeout=15)
response_data = res.json()
self.challenge_id = response_data["challenge"]["id"]
self.headers["X-ROBINHOOD-CHALLENGE-RESPONSE-ID"] = self.challenge_id #has to add this to stay logged in
sms_challenge_endpoint = "https://api.robinhood.com/challenge/{}/respond/".format(self.challenge_id)
print("SMS Code:")
self.sms_code = input()
challenge_res = {"response":self.sms_code}
res2 = self.session.post(sms_challenge_endpoint, data=challenge_res, timeout=15)
res2.raise_for_status()
self.headers["X-ROBINHOOD-CHALLENGE-RESPONSE-ID"] = self.challenge_id #has to add this to stay logged in
#gets access token for final response to stay logged in
res3 = self.session.post(endpoints.login(), data=payload, timeout=15)
res3.raise_for_status()
Expand Down

0 comments on commit 9343f8b

Please sign in to comment.