Skip to content
Snippets Groups Projects
Commit 0614fe5e authored by leszeks's avatar leszeks
Browse files

Initial commit

parent 24d2a446
1 merge request!4Adding download option
Pipeline #1032 failed with stage
in 32 seconds
......@@ -2,3 +2,4 @@ include COPYING
include COPYING.LESSER
include LICENSE-plWN.txt
include LICENSE-PWN.txt
include plwn/config.ini
\ No newline at end of file
[DOWNLOAD]
model = https://minio.clarin-pl.eu/public/models/plwn_api_dumps/plwn_dump_27-03-2018.sqlite
\ No newline at end of file
"""Implementation of download method."""
import configparser
import os
import requests
models = {
"model",
}
def download(name):
"""After called it downloads a specified database model.
Currently only one model available.
"""
if name in models:
cfg = configparser.ConfigParser()
config_path = os.path.join(os.path.dirname(
os.path.abspath(__file__)), "config.ini")
cfg.read(config_path)
url = cfg["DOWNLOAD"][name]
r = requests.get(url)
with open(name, "wb") as f:
f.write(r.content)
f.close()
else:
print("Cannot download: ",
name,
"\n Possible download options: ",
models)
......@@ -17,10 +17,10 @@ setup_args = dict(
author_email='michal.kalinski@pwr.edu.pl',
packages=['plwn', 'plwn.readers', 'plwn.storages', 'plwn.utils'],
package_data={'plwn.default': ['*.db']},
package_data={'plwn.default': ['*.db'],'plwn':['config.ini']},
test_suite='tests.setuptools_loader.setuptools_load_tests',
install_requires=['six>=1.10', 'enum34>=1.1.2;python_version<"3.4"'],
install_requires=['six>=1.10', 'enum34>=1.1.2;python_version<"3.4"','requests'],
zip_safe=False,
)
......
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