Skip to content

Commit

Permalink
Merge pull request #72 from sylvandb/fix-upstream
Browse files Browse the repository at this point in the history
Fix upstream
  • Loading branch information
JECSand authored Oct 18, 2020
2 parents 8b75d70 + e36587b commit c3de405
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/test_yahoofinancials.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ def test_yf_fundamentals(self):
def test_yf_historical_price(self):
single_stock_prices = self.test_yf_stock_single.get_historical_price_data('2015-01-15', '2017-10-15', 'weekly')
expect_dict = {'high': 49.099998474121094, 'volume': 125737200, 'formatted_date': '2015-01-12',
'low': 46.599998474121094, 'adjclose': 45.35684585571289, 'date': 1421038800,
'low': 46.599998474121094, 'date': 1421038800,
'close': 47.61000061035156, 'open': 48.959999084472656}
# ignore adjclose as it will change with every dividend paid in the future
del single_stock_prices['C']['prices'][0]['adjclose']
self.assertDictEqual(single_stock_prices['C']['prices'][0], expect_dict)

# Historical Stock Daily Dividend Test
Expand Down
3 changes: 3 additions & 0 deletions yahoofinancials/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ def _scrape_data(self, url, tech_type, statement_type):
re_script = soup.find("script", text=re.compile("root.App.main"))
if re_script is not None:
script = re_script.text
# bs4 4.9.0 changed so text from scripts is no longer considered text
if not script:
script = re_script.string
self._cache[url] = loads(re.search("root.App.main\s+=\s+(\{.*\})", script).group(1))
response.close()
break
Expand Down

0 comments on commit c3de405

Please sign in to comment.