Skip to content
This repository has been archived by the owner on Feb 27, 2022. It is now read-only.

Commit

Permalink
Reformat code and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
kj7rrv committed Dec 5, 2021
1 parent 14be2b9 commit 5f23f1c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
long_description = fh.read()
setuptools.setup(
name="stockquotes",
version="2.0.2",
version="2.0.3",
description="A simple module for retreiving stock data",
long_description=long_description,
long_description_content_type="text/markdown",
Expand All @@ -13,5 +13,5 @@
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
],
python_requires=">=3.5",
python_requires=">=3.6",
)
8 changes: 7 additions & 1 deletion stockquotes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ def __init__(self, ticker):

change_percent_selector = f'fin-streamer[data-field="regularMarketChangePercent"][data-symbol="{self.symbol}"]'
change_percent_element = soup.select_one(change_percent_selector)
change_percent_text = ''.join([char for char in change_percent_element.text if char in '-.0123456789'])
change_percent_text = "".join(
[
char
for char in change_percent_element.text
if char in "-.0123456789"
]
)
self.increase_percent = float(change_percent_text)
except AttributeError as error:
raise StockDoesNotExistError(ticker) from error

0 comments on commit 5f23f1c

Please sign in to comment.