Skip to content

Commit

Permalink
unfinished script
Browse files Browse the repository at this point in the history
  • Loading branch information
rboman committed Sep 9, 2023
1 parent 03eea35 commit 5e8dd74
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions bin/usemesa.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env python3
# -*- coding: utf8 -*-

from urllib.request import urlretrieve
import os

target_folder = r'D:\dev\Metafor\oo_metaB\bin\Release'
mesa3d_archive_url = r'https://github.com/pal1000/mesa-dist-win/releases/download/23.1.6/mesa3d-23.1.6-release-msvc.7z'

def download_file(url_file):
filename = os.path.basename(url_file)
import urllib.request

response = urllib.request.urlopen(url_file)
data = response.read()

with open(filename, "wb") as file:
file.write(data)

# baseurl = os.path.dirname(url_file)
# filename = os.path.basename(url_file)
# print(baseurl)
# print(filename)
# url = ( baseurl, filename )
# path, headers = urlretrieve(url, filename)
# print('path =', path)
# print('headers =', headers)
# print()
# for name, value in headers.items():
# print(name, value)


# >>> url = (
# ... "https://api.worldbank.org/v2/en/indicator/"
# ... "NY.GDP.MKTP.CD?downloadformat=csv"
# ... )
# >>> filename = "gdp_by_country.zip"

# path, headers = urlretrieve(url, filename)
# >>> for name, value in headers.items():
# ... print(name, value)

if __name__=="__main__":
download_file(mesa3d_archive_url)

0 comments on commit 5e8dd74

Please sign in to comment.