summarylogtreecommitdiffstats
path: root/72.patch
diff options
context:
space:
mode:
authorAnton Kudelin2020-05-18 20:16:35 +0300
committerAnton Kudelin2020-05-18 20:16:35 +0300
commit3990bbba1f48f0a5e60ad7b352d69657b9d95cf5 (patch)
treef33cba0cb1595d19f9a4e7248b06e0c7f49ac158 /72.patch
parent0e17060eeee1883922e9e9cb8760bb36ae413a06 (diff)
downloadaur-3990bbba1f48f0a5e60ad7b352d69657b9d95cf5.tar.gz
Applied a patch from commit 72 on github
Diffstat (limited to '72.patch')
-rw-r--r--72.patch73
1 files changed, 73 insertions, 0 deletions
diff --git a/72.patch b/72.patch
new file mode 100644
index 000000000000..ac34ac733421
--- /dev/null
+++ b/72.patch
@@ -0,0 +1,73 @@
+From 5805c54f96c9222e587603d49130a7c0e710480b Mon Sep 17 00:00:00 2001
+From: Sylvan Butler <gitstuff.sylvan@xoxy.net>
+Date: Fri, 6 Mar 2020 19:55:52 -0700
+Subject: [PATCH 1/3] yahoo issue was the client version
+
+---
+ yahoofinancials/__init__.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/yahoofinancials/__init__.py b/yahoofinancials/__init__.py
+index 294392b..797a89b 100644
+--- a/yahoofinancials/__init__.py
++++ b/yahoofinancials/__init__.py
+@@ -68,7 +68,7 @@ class ManagedException(Exception):
+
+ # Class used to open urls for financial data
+ class UrlOpener(FancyURLopener):
+- version = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11'
++ version = 'w3m/0.5.3+git20180125'
+
+
+ # Class containing Yahoo Finance ETL Functionality
+
+From 5a5566d5de0328e4e799d443b315a5d829a09fe8 Mon Sep 17 00:00:00 2001
+From: Sylvan Butler <gitstuff.sylvan@xoxy.net>
+Date: Fri, 24 Apr 2020 09:38:39 -0600
+Subject: [PATCH 2/3] fix for bs4 4.9.0 script change
+
+preserves compatibility with prior versions
+---
+ yahoofinancials/__init__.py | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/yahoofinancials/__init__.py b/yahoofinancials/__init__.py
+index 797a89b..bd0f885 100644
+--- a/yahoofinancials/__init__.py
++++ b/yahoofinancials/__init__.py
+@@ -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
+
+From e36587b928c00b69f3876187aa15ab48818bccc8 Mon Sep 17 00:00:00 2001
+From: Sylvan Butler <gitstuff.sylvan@xoxy.net>
+Date: Fri, 6 Mar 2020 20:16:51 -0700
+Subject: [PATCH 3/3] fix test for 2020 adjclose
+
+---
+ test/test_yahoofinancials.py | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/test/test_yahoofinancials.py b/test/test_yahoofinancials.py
+index 2b79bc6..bcb6c73 100644
+--- a/test/test_yahoofinancials.py
++++ b/test/test_yahoofinancials.py
+@@ -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