From a134b91755fbbc401c38e296015a66e98bbe8de3 Mon Sep 17 00:00:00 2001 From: HelloKaito <44645675+HelloKaito@users.noreply.github.com> Date: Thu, 2 Feb 2023 15:40:52 +0800 Subject: [PATCH] Update peps_download.py --- peps_download.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/peps_download.py b/peps_download.py index e5ddafe..7672659 100755 --- a/peps_download.py +++ b/peps_download.py @@ -68,6 +68,7 @@ def check_rename(tmpfile, prodsize, options): def parse_catalog(search_json_file): + import json # Filter catalog result with open(search_json_file) as data_file: data = json.load(data_file) @@ -319,18 +320,18 @@ def parse_catalog(search_json_file): # search in catalog # ==================== if (options.product_type == "") and (options.sensor_mode == ""): - search_catalog = 'curl -k -o %s https://peps.cnes.fr/resto/api/collections/%s/search.json?%s\&startDate=%s\&completionDate=%s\&maxRecords=500' % ( + search_catalog = 'curl -k -o %s "https://peps.cnes.fr/resto/api/collections/%s/search.json?%s&startDate=%s&completionDate=%s&maxRecords=500"' % ( options.search_json_file, options.collection, query_geom, start_date, end_date) else: - search_catalog = 'curl -k -o %s https://peps.cnes.fr/resto/api/collections/%s/search.json?%s\&startDate=%s\&completionDate=%s\&maxRecords=500\&productType=%s\&sensorMode=%s' % ( + search_catalog = 'curl -k -o %s "https://peps.cnes.fr/resto/api/collections/%s/search.json?%s&startDate=%s&completionDate=%s&maxRecords=500&productType=%s&sensorMode=%s"' % ( options.search_json_file, options.collection, query_geom, start_date, end_date, options.product_type, options.sensor_mode) -if options.windows: - search_catalog = search_catalog.replace('\&', '^&') +# if options.windows: +# search_catalog = search_catalog.replace('\&', '^&') print(search_catalog) os.system(search_catalog) -time.sleep(5) +time.sleep(1) prod, download_dict, storage_dict, size_dict = parse_catalog(options.search_json_file) @@ -367,14 +368,14 @@ def parse_catalog(search_json_file): while (NbProdsToDownload > 0): # redo catalog search to update disk/tape status if (options.product_type == "") and (options.sensor_mode == ""): - search_catalog = 'curl -k -o %s https://peps.cnes.fr/resto/api/collections/%s/search.json?%s\&startDate=%s\&completionDate=%s\&maxRecords=500' % ( + search_catalog = 'curl -k -o %s "https://peps.cnes.fr/resto/api/collections/%s/search.json?%s&startDate=%s&completionDate=%s&maxRecords=500"' % ( options.search_json_file, options.collection, query_geom, start_date, end_date) else: - search_catalog = 'curl -k -o %s https://peps.cnes.fr/resto/api/collections/%s/search.json?%s\&startDate=%s\&completionDate=%s\&maxRecords=500\&productType=%s\&sensorMode=%s' % ( - options.search_json_file, options.collection, query_geom, start_date, end_date, options.product_type, options.sensor_mode) + search_catalog = 'curl -k -o %s "https://peps.cnes.fr/resto/api/collections/%s/search.json?%s&startDate=%s&completionDate=%s&maxRecords=500&productType=%s&sensorMode=%s"' % ( +# options.search_json_file, options.collection, query_geom, start_date, end_date, options.product_type, options.sensor_mode) - if options.windows: - search_catalog = search_catalog.replace('\&', '^&') +# if options.windows: +# search_catalog = search_catalog.replace('\&', '^&') os.system(search_catalog) time.sleep(2)