Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove TODO #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions friartuck/Robinhood/Robinhood.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,20 +637,13 @@ def get_fundamentals(self, stock=''):
(:obj:`dict`): contents of `fundamentals` endpoint

"""
#Prompt for stock if not entered
if not stock: #pragma: no cover
stock = input("Symbol: ")

url = str(self.endpoints['fundamentals']) + str(stock.upper()) + "/"
#Check for validity of symbol
try:
req = requests.get(url)
req.raise_for_status()
data = req.json()
except requests.exceptions.HTTPError:
raise NameError('Invalid Symbol: ' + stock) #TODO wrap custom exception

return data
return self.session.get(self.endpoints['fundamentals']+stock.upper()+"/").json()
except requests.exceptions.HTTPError as e:
if e.response.status_code == 404:
raise RobinhoodException("Invalid stock ticker")
else:
raise e


def fundamentals(self, stock=''):
Expand Down