Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fao-fetcher
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
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
dbnomics-fetchers
fao-fetcher
Commits
0c92afa0
Commit
0c92afa0
authored
4 years ago
by
Enzo Buthiot
Browse files
Options
Downloads
Patches
Plain Diff
Correct mistake
parent
c63c6c6f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#255714
passed with stage
Stage:
in 14 minutes and 17 seconds
Changes
1
Pipelines
133
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
download.py
+5
-4
5 additions, 4 deletions
download.py
with
5 additions
and
4 deletions
download.py
+
5
−
4
View file @
0c92afa0
...
...
@@ -52,6 +52,7 @@ def download_file(path: Path, url):
zip_ref
.
extractall
(
path
)
# extract file to dir
zip_ref
.
close
()
# close file
os
.
remove
(
file_name
)
# delete zipped file
return
zip_list
def
download_dataset_json
(
path
:
Path
,
url
):
...
...
@@ -110,12 +111,12 @@ def main():
# Download flags.json
download_flag_json
(
target_dir
,
flag_url
)
# Download main FAO file
download_file
(
target_dir
,
url
)
# Download main FAO file
and return zip_list
zip_list
=
download_file
(
target_dir
,
url
)
# Create zip_dict where key = zip name and value = csv name,
# then save it to target directory
zip_dict
=
dict
()
zip_file
=
zipfile
.
ZipFile
(
'
/Users/EnzoButhiot/Downloads/FAOSTAT.zip
'
,
'
r
'
)
zip_list
=
zip_file
.
namelist
()
for
name
in
zip_list
:
if
name
not
in
zip_dict
.
keys
():
zip_dict
[
name
]
=
''
...
...
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