summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO6
-rw-r--r--72.patch73
-rw-r--r--PKGBUILD11
3 files changed, 84 insertions, 6 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 7262bd339e1a..f593ab528f15 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = python-yahoofinancials
pkgdesc = A powerful financial data module used for pulling data from Yahoo Finance
pkgver = 1.5
- pkgrel = 1
+ pkgrel = 2
url = https://github.com/JECSand/yahoofinancials
arch = any
license = MIT
@@ -9,8 +9,10 @@ pkgbase = python-yahoofinancials
depends = python-requests
depends = python-beautifulsoup4
depends = python-pytz
- source = https://github.com/JECSand/yahoofinancials/archive/1.5.tar.gz
+ source = python-yahoofinancials-1.5.tar.gz::https://github.com/JECSand/yahoofinancials/archive/1.5.tar.gz
+ source = 72.patch
sha256sums = 372d30edbb25e6bd6fafa73bf915412b40522912cff14cba9ec28a50a3a105bd
+ sha256sums = 837ff84e3e285bb5e8da0323c7d520f6ff5df3ce9b28cad1da390a8f896c99ad
pkgname = python-yahoofinancials
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
diff --git a/PKGBUILD b/PKGBUILD
index fe98170348a3..7666e85d1642 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,20 +2,23 @@
# Contributor: HÃ¥vard Pettersson <mail@haavard.me>
_name=yahoofinancials
-pkgname=(python-$_name)
+pkgname=python-$_name
pkgver=1.5
-pkgrel=1
+pkgrel=2
pkgdesc='A powerful financial data module used for pulling data from Yahoo Finance'
url='https://github.com/JECSand/yahoofinancials'
arch=('any')
license=('MIT')
depends=('python-requests' 'python-beautifulsoup4' 'python-pytz')
makedepends=('python-setuptools')
-source=("https://github.com/JECSand/$_name/archive/$pkgver.tar.gz")
-sha256sums=('372d30edbb25e6bd6fafa73bf915412b40522912cff14cba9ec28a50a3a105bd')
+source=("$pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz"
+ "72.patch")
+sha256sums=('372d30edbb25e6bd6fafa73bf915412b40522912cff14cba9ec28a50a3a105bd'
+ '837ff84e3e285bb5e8da0323c7d520f6ff5df3ce9b28cad1da390a8f896c99ad')
build(){
cd "$srcdir/$_name-$pkgver"
+ patch -p1 < ../72.patch
python setup.py build
}