-
-
Notifications
You must be signed in to change notification settings - Fork 369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Economics Module HTTP Error 403 #162
Comments
Hi! I'll have a look today/tomorrow. |
It seems the current method is being blocked. I need to revise this menu altogether as it can break too easily right now unfortunately. |
JerBouma
added a commit
that referenced
this issue
Dec 12, 2024
JerBouma
added a commit
that referenced
this issue
Dec 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
There seems to be a problem with the Economics module connecting to a website to scrap for data. I have included minimal code needed to reproduce the error, the version of modules on my system, the python version, and OS version. Please let me know if there is anything else I should include.
Minimal code needed to reproduce:
"
from financetoolkit import Economics
cls_economics = Economics(start_date = "2017-01-01",
end_date = "2018-01-01", quarterly = True)
cls_economics.get_gross_domestic_product_growth(quarterly = True)
"
Error:
"
Traceback (most recent call last):
File "C:\Users\jamie\Desktop\Personal\Finance\Stock_Picker\testBrokenEco.py", line 5, in
cls_economics.get_gross_domestic_product_growth(quarterly = True)
File "C:\Users\jamie\AppData\Local\Programs\Python\Python312\Lib\site-packages\financetoolkit\economics\economics_controller.py", line 192, in get_gross_domestic_product_growth
growth_gdp = oecd_model.get_quarterly_gross_domestic_product(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jamie\AppData\Local\Programs\Python\Python312\Lib\site-packages\financetoolkit\economics\oecd_model.py", line 272, in get_quarterly_gross_domestic_product
gross_domestic_product = collect_oecd_data(oecd_data_string, "Q")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jamie\AppData\Local\Programs\Python\Python312\Lib\site-packages\financetoolkit\economics\oecd_model.py", line 202, in collect_oecd_data
oecd_data = pd.read_csv(f"{BASE_URL}{oecd_data_string}{EXTENSIONS}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jamie\AppData\Local\Programs\Python\Python312\Lib\site-packages\pandas\io\parsers\readers.py", line 1026, in read_csv
return _read(filepath_or_buffer, kwds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jamie\AppData\Local\Programs\Python\Python312\Lib\site-packages\pandas\io\parsers\readers.py", line 620, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jamie\AppData\Local\Programs\Python\Python312\Lib\site-packages\pandas\io\parsers\readers.py", line 1620, in init
self._engine = self._make_engine(f, self.engine)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jamie\AppData\Local\Programs\Python\Python312\Lib\site-packages\pandas\io\parsers\readers.py", line 1880, in _make_engine
self.handles = get_handle(
^^^^^^^^^^^
File "C:\Users\jamie\AppData\Local\Programs\Python\Python312\Lib\site-packages\pandas\io\common.py", line 728, in get_handle
ioargs = _get_filepath_or_buffer(
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jamie\AppData\Local\Programs\Python\Python312\Lib\site-packages\pandas\io\common.py", line 384, in _get_filepath_or_buffer
with urlopen(req_info) as req:
^^^^^^^^^^^^^^^^^
File "C:\Users\jamie\AppData\Local\Programs\Python\Python312\Lib\site-packages\pandas\io\common.py", line 289, in urlopen
return urllib.request.urlopen(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jamie\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 215, in urlopen
return opener.open(url, data, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jamie\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 521, in open
response = meth(req, response)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\jamie\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 630, in http_response
response = self.parent.error(
^^^^^^^^^^^^^^^^^^
File "C:\Users\jamie\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 559, in error
return self._call_chain(*args)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jamie\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 492, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "C:\Users\jamie\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 639, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
"
running Python -m pip list gives:
"Package Version
absl-py 2.1.0
astunparse 1.6.3
beautifulsoup4 4.12.3
Bottleneck 1.4.0
certifi 2024.7.4
charset-normalizer 3.3.2
contourpy 1.2.1
cycler 0.12.1
financedatabase 2.2.2
financetoolkit 1.9.8
flatbuffers 24.3.25
fonttools 4.53.1
frozendict 2.4.4
gast 0.6.0
google-pasta 0.2.0
grpcio 1.66.2
h5py 3.12.1
html5lib 1.1
idna 3.7
inflection 0.5.1
joblib 1.4.2
keras 3.6.0
kiwisolver 1.4.5
libclang 18.1.1
llvmlite 0.43.0
lxml 5.3.0
Markdown 3.7
markdown-it-py 3.0.0
MarkupSafe 3.0.1
matplotlib 3.9.2
mdurl 0.1.2
ml-dtypes 0.4.1
more-itertools 10.4.0
multitasking 0.0.11
namex 0.0.8
numba 0.60.0
numexpr 2.10.1
numpy 1.26.4
opt_einsum 3.4.0
optree 0.13.0
packaging 24.1
pandas 2.2.2
peewee 3.17.6
pillow 10.4.0
pip 24.3.1
platformdirs 4.3.6
protobuf 4.25.5
Pygments 2.18.0
pyparsing 3.1.2
python-dateutil 2.9.0.post0
pytz 2024.1
Quandl 3.7.0
requests 2.32.3
rich 13.9.2
scikit-learn 1.5.1
scipy 1.14.0
setuptools 75.1.0
six 1.16.0
soupsieve 2.6
tensorboard 2.17.1
tensorboard-data-server 0.7.2
tensorflow 2.17.0
tensorflow-intel 2.17.0
termcolor 2.5.0
threadpoolctl 3.5.0
typing_extensions 4.12.2
tzdata 2024.1
urllib3 2.2.2
webencodings 0.5.1
Werkzeug 3.0.4
wheel 0.44.0
wrapt 1.16.0
xarray 2024.7.0
yfinance 0.2.43
"
On Python version "Python 3.12.5"
Code run on Windows 10.
The text was updated successfully, but these errors were encountered: