Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
JOSSOUD Olivier
WIM Collect
Commits
5481ee89
Commit
5481ee89
authored
Jan 22, 2020
by
JOSSOUD Olivier
Browse files
FTPOPAR. Download single day.
parent
f16913bf
Pipeline
#57036
passed with stages
in 1 minute and 36 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
wimcollect/ftpopar.py
wimcollect/ftpopar.py
+8
-10
No files found.
wimcollect/ftpopar.py
View file @
5481ee89
...
...
@@ -13,7 +13,7 @@ class Collector(ftp.FtpCollector):
self
.
object_id
=
"FTPOPAR"
ftp
.
FtpCollector
.
__init__
(
self
,
self
.
object_id
,
config_parser
,
log
)
def
download_maido_ftir
(
self
,
first_day
:
datetime
.
date
,
last_
day
:
datetime
.
date
):
def
download_maido_ftir
(
self
,
day
:
datetime
.
date
):
"""Download all Picarro files from FTP server.
The distant files will be deleted from the server if the transfer is successful.
...
...
@@ -25,17 +25,15 @@ class Collector(ftp.FtpCollector):
"""
self
.
logger
.
write
(
self
.
object_id
,
"Download Maido's FTIR meteo data."
)
self
.
_ftp_connect_
()
ftp_session
=
self
.
_ftp_connect_
()
days_list
=
[
first_day
+
datetime
.
timedelta
(
days
=
x
)
for
x
in
range
((
last_day
-
first_day
).
days
+
1
)]
for
day
in
days_list
:
source_filepath
=
self
.
base_dir
+
"/"
+
day
.
strftime
(
"%Y%m%d"
)
+
"Meteo125HR.xls"
dest_filepath
=
self
.
__get_dest_filepath__
(
day
)
success
=
self
.
_ftp_download_file
(
self
.
session
,
source_filepath
,
dest_filepath
)
if
success
:
self
.
__compress_file__
(
day
,
dest_filepath
)
source_filepath
=
self
.
base_dir
+
"/"
+
day
.
strftime
(
"%Y%m%d"
)
+
"Meteo125HR.xls"
dest_filepath
=
self
.
__get_dest_filepath__
(
day
)
success
=
self
.
_ftp_download_file
(
ftp_session
,
source_filepath
,
dest_filepath
)
if
success
:
self
.
__compress_file__
(
day
,
dest_filepath
)
self
.
session
.
quit
()
ftp_
session
.
quit
()
def
__get_dest_filepath__
(
self
,
day
:
datetime
.
date
)
->
str
:
# Build destination directory
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment