From dc6d0f3246190d056122003a15bf76b454594d23 Mon Sep 17 00:00:00 2001 From: connorsanders Date: Mon, 17 Jul 2023 21:32:13 -0500 Subject: [PATCH] fix for #152 and minor test code cleanup --- CHANGES | 12 +++++++----- README.rst | 4 ++-- setup.py | 4 ++-- test/test_yahoofinancials.py | 13 +++++-------- yahoofinancials/maps.py | 2 +- yahoofinancials/yf.py | 6 +++--- 6 files changed, 20 insertions(+), 21 deletions(-) diff --git a/CHANGES b/CHANGES index 2d15466..ad37ca5 100644 --- a/CHANGES +++ b/CHANGES @@ -48,8 +48,10 @@ 1.13 02/14/2023 -- Added additional unit tests. 1.14 02/21/2023 -- Fixed get_ten_day_avg_daily_volume as reported in #137. 1.14 02/21/2023 -- Removed get_three_month_avg_daily_volume due to value now missing in Yahoo data. -1.14 02/21/2023 -- Added unit test for get_ten_day_avg_daily_volume -1.15 06/21/2023 -- Dropped Python 3.6 support -1.15 06/21/2023 -- Enhanced cache to cover all api requests -1.15 06/21/2023 -- Enhanced api url to better toggle between query1 and query2 subdomains -1.15 06/21/2023 -- Minimized sleeps in between 400 errors to less than 10 seconds +1.14 02/21/2023 -- Added unit test for get_ten_day_avg_daily_volume. +1.15 06/21/2023 -- Dropped Python 3.6 support. +1.15 06/21/2023 -- Enhanced cache to cover all api requests. +1.15 06/21/2023 -- Enhanced api url to better toggle between query1 and query2 subdomains. +1.15 06/21/2023 -- Minimized sleeps in between 400 errors to less than 10 seconds. +1.16 07/17/2023 -- Minor code cleanup in test_yahoofinancials.py. +1.16 07/17/2023 -- Fixed HTTP 401 error when executing get_current_price() as reported in #152. diff --git a/README.rst b/README.rst index 4a1f7d0..9797b50 100644 --- a/README.rst +++ b/README.rst @@ -16,9 +16,9 @@ A python module that returns stock, cryptocurrency, forex, mutual fund, commodit .. image:: https://static.pepy.tech/badge/yahoofinancials/week :target: https://pepy.tech/project/yahoofinancials -Current Version: v1.15 +Current Version: v1.16 -Version Released: 06/21/2023 +Version Released: 07/17/2023 Report any bugs by opening an issue here: https://github.com/JECSand/yahoofinancials/issues diff --git a/setup.py b/setup.py index aa339f8..84e9820 100644 --- a/setup.py +++ b/setup.py @@ -10,11 +10,11 @@ setup( name='yahoofinancials', - version='1.15', + version='1.16', description='A powerful financial data module used for pulling both fundamental and technical data from Yahoo Finance', long_description=long_description, url='https://github.com/JECSand/yahoofinancials', - download_url='https://github.com/JECSand/yahoofinancials/archive/1.15.tar.gz', + download_url='https://github.com/JECSand/yahoofinancials/archive/1.16.tar.gz', author='Connor Sanders', author_email='connor@exceleri.com', license='MIT', diff --git a/test/test_yahoofinancials.py b/test/test_yahoofinancials.py index 56d195f..cca2c4c 100644 --- a/test/test_yahoofinancials.py +++ b/test/test_yahoofinancials.py @@ -1,5 +1,5 @@ -# YahooFinancials Unit Tests v1.15 -# Version Released: 06/21/2023 +# YahooFinancials Unit Tests v1.16 +# Version Released: 07/17/2023 # Author: Connor Sanders # Tested on Python 3.7, 3.8, 3.9, 3.10, and 3.11 # Copyright (c) 2023 Connor Sanders @@ -19,20 +19,17 @@ def check_fundamental(test_data, test_type): if test_type == 'bal': if 'balanceSheetHistoryQuarterly' in test_data and test_data['balanceSheetHistoryQuarterly']['C'] is not None: return True - else: - return False + return False elif test_type == 'inc': if 'incomeStatementHistoryQuarterly' in test_data and \ test_data['incomeStatementHistoryQuarterly']['C'] is not None: return True - else: - return False + return False elif test_type == 'all': if 'balanceSheetHistoryQuarterly' in test_data and 'incomeStatementHistoryQuarterly' in test_data and \ 'cashflowStatementHistoryQuarterly' in test_data: return True - else: - return False + return False # Main Test Module Class diff --git a/yahoofinancials/maps.py b/yahoofinancials/maps.py index 9110dbd..6675ffa 100644 --- a/yahoofinancials/maps.py +++ b/yahoofinancials/maps.py @@ -2349,7 +2349,7 @@ REQUEST_MAP = { "quoteSummary": { - "path": "https://query2.finance.yahoo.com/v10/finance/quoteSummary/{symbol}", + "path": "https://query2.finance.yahoo.com/v6/finance/quoteSummary/{symbol}", "response_field": "quoteSummary", "request": { "formatted": {"required": False, "default": False}, diff --git a/yahoofinancials/yf.py b/yahoofinancials/yf.py index e8d550c..d6eb447 100644 --- a/yahoofinancials/yf.py +++ b/yahoofinancials/yf.py @@ -1,12 +1,12 @@ """ ============================== The Yahoo Financials Module -Version: 1.15 +Version: 1.16 ============================== Author: Connor Sanders Email: sandersconnor1@gmail.com -Version Released: 06/21/2023 +Version Released: 07/17/2023 Tested on Python 3.7, 3.8, 3.9, 3.10, and 3.11 Copyright (c) 2023 Connor Sanders @@ -44,7 +44,7 @@ from yahoofinancials.calcs import num_shares_outstanding, eps from yahoofinancials.etl import YahooFinanceETL -__version__ = "1.15" +__version__ = "1.16" __author__ = "Connor Sanders"