Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PLWN_API
Manage
Activity
Members
Labels
Plan
Issues
10
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Libraries
PLWN_API
Commits
0614fe5e
Commit
0614fe5e
authored
4 years ago
by
leszeks
Browse files
Options
Downloads
Patches
Plain Diff
Initial commit
parent
24d2a446
1 merge request
!4
Adding download option
Pipeline
#1032
failed with stage
in 32 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
MANIFEST.in
+1
-0
1 addition, 0 deletions
MANIFEST.in
plwn/config.ini
+2
-0
2 additions, 0 deletions
plwn/config.ini
plwn/download.py
+31
-0
31 additions, 0 deletions
plwn/download.py
setup.py
+2
-2
2 additions, 2 deletions
setup.py
with
36 additions
and
2 deletions
MANIFEST.in
+
1
−
0
View file @
0614fe5e
...
...
@@ -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
This diff is collapsed.
Click to expand it.
plwn/config.ini
0 → 100644
+
2
−
0
View file @
0614fe5e
[DOWNLOAD]
model
=
https://minio.clarin-pl.eu/public/models/plwn_api_dumps/plwn_dump_27-03-2018.sqlite
\ No newline at end of file
This diff is collapsed.
Click to expand it.
plwn/download.py
0 → 100644
+
31
−
0
View file @
0614fe5e
"""
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
)
This diff is collapsed.
Click to expand it.
setup.py
+
2
−
2
View file @
0614fe5e
...
...
@@ -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
,
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment