mortada / fredapi

Python API for FRED (Federal Reserve Economic Data) and ALFRED (Archival FRED)
Apache License 2.0
902 stars 159 forks source link

fredapi doesn't work anymore with Python 3.9, uses removed function getchildren #36

Closed mj-64 closed 3 years ago

mj-64 commented 3 years ago

Using Python 3.9, fredapi does not work any longer because it uses the function getchildren() for xml.etree.Elements. This function is deprecated and has been removed with Python 3.9.

I created a pull request to fix it:

Solution: Just remove all getchildren() calls and change to iteration, e.g in get_series():

for child in root.getchildren(): ...

change to:

for child in root: ...

See https://docs.python.org/3.8/library/xml.etree.elementtree.html and https://docs.python.org/3.9/library/xml.etree.elementtree.html, search for getchildren()

mortada commented 3 years ago

@mj-64 thanks for reporting this! version 0.4.3 includes your fix and has been published