Commit 533ed7a9 authored by Christophe Benz's avatar Christophe Benz

Use direct link to ZIP file

parent e7c83dd7
Pipeline #1690 failed with stage
in 1 minute and 38 seconds
......@@ -110,13 +110,10 @@ def main():
cwd=args.target_dir,
)
page_url = 'https://ec.europa.eu/info/business-economy-euro/indicators-statistics/economic-databases' \
'/macro-economic-database-ameco/download-annual-data-set-macro-economic-database-ameco_en'
response = urllib.request.urlopen(page_url)
html = response.read().decode("utf-8")
html_element = lxml.html.document_fromstring(html)
database_url_path = html_element.xpath('//a[@title="ameco0.zip"]')[0].attrib['href']
database_url = urllib.parse.urljoin(page_url, database_url_path)
# From https://ec.europa.eu/info/business-economy-euro/indicators-statistics/economic-databases \
# /macro-economic-database-ameco/download-annual-data-set-macro-economic-database-ameco_en
database_url = 'http://ec.europa.eu/economy_finance/db_indicators/ameco/documents/ameco0.zip'
response = urllib.request.urlopen(database_url)
print('Loading database: {}'.format(database_url))
response = urllib.request.urlopen(database_url)
with zipfile.ZipFile(io.BytesIO(response.read())) as database_zip:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment