lookyloo/tools/3rdparty.py

31 lines
1.1 KiB
Python
Raw Normal View History

2020-09-28 13:57:21 +02:00
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
2021-10-18 13:06:43 +02:00
from lookyloo.default import get_homedir
2020-09-28 13:57:21 +02:00
2021-07-21 11:56:38 +02:00
d3js_version = '7'
2021-09-28 17:56:16 +02:00
datatables_version = "1.11.3"
2020-09-28 13:57:21 +02:00
if __name__ == '__main__':
dest_dir = get_homedir() / 'website' / 'web' / 'static'
d3 = requests.get(f'https://d3js.org/d3.v{d3js_version}.min.js')
with (dest_dir / f'd3.v{d3js_version}.min.js').open('wb') as f:
2020-09-28 13:57:21 +02:00
f.write(d3.content)
print(f'Downloaded d3js v{d3js_version}.')
datatables_js = requests.get(f'https://cdn.datatables.net/v/bs4/dt-{datatables_version}/datatables.min.js')
2020-09-28 13:57:21 +02:00
with (dest_dir / 'datatables.min.js').open('wb') as f:
f.write(datatables_js.content)
2020-09-28 13:57:21 +02:00
print(f'Downloaded datatables js v{datatables_version}.')
datatables_css = requests.get(f'https://cdn.datatables.net/v/bs4/dt-{datatables_version}/datatables.min.css')
2020-09-28 13:57:21 +02:00
with (dest_dir / 'datatables.min.css').open('wb') as f:
f.write(datatables_css.content)
2020-09-28 13:57:21 +02:00
print(f'Downloaded datatables_css v{datatables_version}.')
print('All 3rd party modules for the website were downloaded.')