Reformat code and bump version

This commit is contained in:
Samuel Sloniker 2021-12-04 18:53:48 -08:00
parent 14be2b99c5
commit 5f23f1c04c
2 changed files with 9 additions and 3 deletions

View File

@ -4,7 +4,7 @@ with open("README.md", "r") as fh:
long_description = fh.read() long_description = fh.read()
setuptools.setup( setuptools.setup(
name="stockquotes", name="stockquotes",
version="2.0.2", version="2.0.3",
description="A simple module for retreiving stock data", description="A simple module for retreiving stock data",
long_description=long_description, long_description=long_description,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
@ -13,5 +13,5 @@ setuptools.setup(
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"Operating System :: OS Independent", "Operating System :: OS Independent",
], ],
python_requires=">=3.5", python_requires=">=3.6",
) )

View File

@ -89,7 +89,13 @@ class Stock:
change_percent_selector = f'fin-streamer[data-field="regularMarketChangePercent"][data-symbol="{self.symbol}"]' change_percent_selector = f'fin-streamer[data-field="regularMarketChangePercent"][data-symbol="{self.symbol}"]'
change_percent_element = soup.select_one(change_percent_selector) 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) self.increase_percent = float(change_percent_text)
except AttributeError as error: except AttributeError as error:
raise StockDoesNotExistError(ticker) from error raise StockDoesNotExistError(ticker) from error