From f7f43c4458a155237321528c9a46e2aa4a3e824d Mon Sep 17 00:00:00 2001 From: alvarobartt Date: Thu, 8 Apr 2021 14:04:11 +0200 Subject: [PATCH] quick bug fix as Investing.com changed headers (thanks to @nhlsm) --- docs/source/_info/installation.rst | 2 +- docs/source/conf.py | 2 +- investpy/__init__.py | 2 +- investpy/bonds.py | 8 ++++---- investpy/certificates.py | 8 ++++---- investpy/commodities.py | 8 ++++---- investpy/crypto.py | 10 +++++----- investpy/currency_crosses.py | 8 ++++---- investpy/etfs.py | 8 ++++---- investpy/funds.py | 8 ++++---- investpy/indices.py | 8 ++++---- investpy/news.py | 2 +- investpy/search.py | 4 ++-- investpy/stocks.py | 18 +++++++++--------- investpy/technical.py | 6 +++--- investpy/utils/search_obj.py | 6 +++--- setup.py | 4 ++-- 17 files changed, 56 insertions(+), 56 deletions(-) diff --git a/docs/source/_info/installation.rst b/docs/source/_info/installation.rst index 2deed77b..e4e9675a 100644 --- a/docs/source/_info/installation.rst +++ b/docs/source/_info/installation.rst @@ -5,7 +5,7 @@ Installation .. note:: - After installing the package you are now available to use it! As investpy's latest release is 1.0.4 the installation is + After installing the package you are now available to use it! As investpy's latest release is 1.0.5 the installation is optimized for it. If you try installing another investpy release, some features may not work. First Installation diff --git a/docs/source/conf.py b/docs/source/conf.py index 7f1b7d48..5e9f606e 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -22,7 +22,7 @@ author = 'Alvaro Bartolome del Canto' # The full version, including alpha/beta/rc tags -release = '1.0.4' +release = '1.0.5' # -- General configuration --------------------------------------------------- diff --git a/investpy/__init__.py b/investpy/__init__.py index dc8c3f17..b659e262 100644 --- a/investpy/__init__.py +++ b/investpy/__init__.py @@ -2,7 +2,7 @@ # See LICENSE for details. __author__ = 'Alvaro Bartolome @ alvarobartt in GitHub' -__version__ = '1.0.4' +__version__ = '1.0.5' from .stocks import get_stocks, get_stocks_list, get_stocks_dict, get_stock_countries, get_stock_recent_data, \ get_stock_historical_data, get_stock_company_profile, get_stock_dividends, get_stock_information, get_stocks_overview, \ diff --git a/investpy/bonds.py b/investpy/bonds.py index 3bde60ad..cbcd0d74 100644 --- a/investpy/bonds.py +++ b/investpy/bonds.py @@ -266,7 +266,7 @@ def get_bond_recent_data(bond, as_json=False, order='ascending', interval='Daily "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -505,7 +505,7 @@ def get_bond_historical_data(bond, from_date, to_date, as_json=False, order='asc "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -655,7 +655,7 @@ def get_bond_information(bond, as_json=False): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -812,7 +812,7 @@ def get_bonds_overview(country, as_json=False): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } diff --git a/investpy/certificates.py b/investpy/certificates.py index 965ca757..8f3e43ec 100644 --- a/investpy/certificates.py +++ b/investpy/certificates.py @@ -287,7 +287,7 @@ def get_certificate_recent_data(certificate, country, as_json=False, order='asce "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -540,7 +540,7 @@ def get_certificate_historical_data(certificate, country, from_date, to_date, as "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -702,7 +702,7 @@ def get_certificate_information(certificate, country, as_json=False): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -838,7 +838,7 @@ def get_certificates_overview(country, as_json=False, n_results=100): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } diff --git a/investpy/commodities.py b/investpy/commodities.py index bb4af468..57f941a8 100644 --- a/investpy/commodities.py +++ b/investpy/commodities.py @@ -298,7 +298,7 @@ def get_commodity_recent_data(commodity, country=None, as_json=False, order='asc "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -566,7 +566,7 @@ def get_commodity_historical_data(commodity, from_date, to_date, country=None, a "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -750,7 +750,7 @@ def get_commodity_information(commodity, country=None, as_json=False): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -892,7 +892,7 @@ def get_commodities_overview(group, as_json=False, n_results=100): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } diff --git a/investpy/crypto.py b/investpy/crypto.py index b2d13396..8559b719 100644 --- a/investpy/crypto.py +++ b/investpy/crypto.py @@ -243,7 +243,7 @@ def get_crypto_recent_data(crypto, as_json=False, order='ascending', interval='D "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -489,7 +489,7 @@ def get_crypto_historical_data(crypto, from_date, to_date, as_json=False, order= "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -645,7 +645,7 @@ def get_crypto_information(crypto, as_json=False): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -734,7 +734,7 @@ def get_cryptos_overview(as_json=False, n_results=100): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -802,7 +802,7 @@ def get_cryptos_overview(as_json=False, n_results=100): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } diff --git a/investpy/currency_crosses.py b/investpy/currency_crosses.py index 76e8fb58..6d489e91 100644 --- a/investpy/currency_crosses.py +++ b/investpy/currency_crosses.py @@ -301,7 +301,7 @@ def get_currency_cross_recent_data(currency_cross, as_json=False, order='ascendi "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -538,7 +538,7 @@ def get_currency_cross_historical_data(currency_cross, from_date, to_date, as_js "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -687,7 +687,7 @@ def get_currency_cross_information(currency_cross, as_json=False): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -814,7 +814,7 @@ def get_currency_crosses_overview(currency, as_json=False, n_results=100): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } diff --git a/investpy/etfs.py b/investpy/etfs.py index 9d0ba6f1..4698e437 100644 --- a/investpy/etfs.py +++ b/investpy/etfs.py @@ -337,7 +337,7 @@ def get_etf_recent_data(etf, country, stock_exchange=None, as_json=False, order= "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -655,7 +655,7 @@ def get_etf_historical_data(etf, country, from_date, to_date, stock_exchange=Non "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -827,7 +827,7 @@ def get_etf_information(etf, country, as_json=False): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -967,7 +967,7 @@ def get_etfs_overview(country, as_json=False, n_results=100): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } diff --git a/investpy/funds.py b/investpy/funds.py index 01a3c8cf..25acb9c0 100644 --- a/investpy/funds.py +++ b/investpy/funds.py @@ -281,7 +281,7 @@ def get_fund_recent_data(fund, country, as_json=False, order='ascending', interv "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -531,7 +531,7 @@ def get_fund_historical_data(fund, country, from_date, to_date, as_json=False, o "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -694,7 +694,7 @@ def get_fund_information(fund, country, as_json=False): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -833,7 +833,7 @@ def get_funds_overview(country, as_json=False, n_results=100): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } diff --git a/investpy/indices.py b/investpy/indices.py index eb074bd0..316c1ecf 100644 --- a/investpy/indices.py +++ b/investpy/indices.py @@ -283,7 +283,7 @@ def get_index_recent_data(index, country, as_json=False, order='ascending', inte "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -541,7 +541,7 @@ def get_index_historical_data(index, country, from_date, to_date, as_json=False, "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -704,7 +704,7 @@ def get_index_information(index, country, as_json=False): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -841,7 +841,7 @@ def get_indices_overview(country, as_json=False, n_results=100): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } diff --git a/investpy/news.py b/investpy/news.py index 73f4464e..cd68d3b1 100644 --- a/investpy/news.py +++ b/investpy/news.py @@ -108,7 +108,7 @@ def economic_calendar(time_zone=None, time_filter='time_only', countries=None, i "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } diff --git a/investpy/search.py b/investpy/search.py index e90eeb93..81866cf4 100644 --- a/investpy/search.py +++ b/investpy/search.py @@ -108,7 +108,7 @@ class instances which will contain the search results so that they can be easily "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -201,7 +201,7 @@ def search_events(text, importances=None, countries=None, n_results=None): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } diff --git a/investpy/stocks.py b/investpy/stocks.py index f1c6c785..c4bd585e 100644 --- a/investpy/stocks.py +++ b/investpy/stocks.py @@ -286,7 +286,7 @@ def get_stock_recent_data(stock, country, as_json=False, order='ascending', inte "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -547,7 +547,7 @@ def get_stock_historical_data(stock, country, from_date, to_date, as_json=False, "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -745,7 +745,7 @@ def get_stock_company_profile(stock, country='spain', language='english'): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -781,7 +781,7 @@ def get_stock_company_profile(stock, country='spain', language='english'): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -867,7 +867,7 @@ def get_stock_dividends(stock, country): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -933,7 +933,7 @@ def get_stock_dividends(stock, country): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -1089,7 +1089,7 @@ def get_stock_information(stock, country, as_json=False): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -1218,7 +1218,7 @@ def get_stocks_overview(country, as_json=False, n_results=100): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -1409,7 +1409,7 @@ def get_stock_financial_summary(stock, country, summary_type='income_statement', "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } diff --git a/investpy/technical.py b/investpy/technical.py index 9b9e0fa9..933456fb 100644 --- a/investpy/technical.py +++ b/investpy/technical.py @@ -135,7 +135,7 @@ def technical_indicators(name, country, product_type, interval='daily'): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -285,7 +285,7 @@ def moving_averages(name, country, product_type, interval='daily'): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -439,7 +439,7 @@ def pivot_points(name, country, product_type, interval='daily'): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } diff --git a/investpy/utils/search_obj.py b/investpy/utils/search_obj.py index 39970435..0d3dee5f 100644 --- a/investpy/utils/search_obj.py +++ b/investpy/utils/search_obj.py @@ -189,7 +189,7 @@ def retrieve_information(self): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -259,7 +259,7 @@ def _prepare_request(self, header): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } @@ -280,7 +280,7 @@ def _prepare_historical_request(self, header, from_date, to_date): "User-Agent": random_user_agent(), "X-Requested-With": "XMLHttpRequest", "Accept": "text/html", - "Accept-Encoding": "gzip, deflate, br", + "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", } diff --git a/setup.py b/setup.py index 071f0898..7b38b625 100644 --- a/setup.py +++ b/setup.py @@ -20,10 +20,10 @@ def requirements(filename): setup( name='investpy', - version='1.0.4', + version='1.0.5', packages=find_packages(), url='https://investpy.readthedocs.io/', - download_url='https://github.com/alvarobartt/investpy/archive/1.0.4.tar.gz', + download_url='https://github.com/alvarobartt/investpy/archive/1.0.5.tar.gz', license='MIT License', author='Alvaro Bartolome', author_email='alvarobdc@yahoo.com',