Skip to content
Snippets Groups Projects
Commit 713adc1b authored by Aymane Hafiane's avatar Aymane Hafiane
Browse files

feature 2941 user data: list user s private folder

parent 2f50a3d6
No related branches found
No related tags found
1 merge request!1Feature/2941 s3 user data
......@@ -159,7 +159,7 @@ def get_token(email, password):
#########################
def is_file_older_than_x_hour(file, hour=1):
file_time = path.getmtime(file)
# Check against 214 hour
# Check against 214 hour
return ((time.time() - file_time) > 3600 * hour)
......@@ -475,7 +475,7 @@ def download(path, name, private: bool):
# Get the presigned url to download the data
url = "https://gravitee-gateway." + MAAP_ENV_TYPE.lower() + ".esa-maap.org/s3/" + path
response = requests.get(url, headers={'Authorization': 'Bearer ' + token}, params={'private': str(private)},
response = requests.get(url, headers={'Authorization': 'Bearer ' + token}, params={'private': private},
allow_redirects=False)
if response.status_code == 401:
print(response.content)
......@@ -515,7 +515,7 @@ def download_file(url, name):
##########################
# list data in s3 folder #
##########################
def list(path):
def list(path, private: bool):
print("[INFO]: Start finding data in path : " + path)
if path:
......@@ -532,7 +532,8 @@ def list(path):
url = "https://gravitee-gateway." + MAAP_ENV_TYPE.lower() + ".esa-maap.org/s3/" + path + "?list=true"
response = requests.get(url, headers={'Authorization': 'Bearer ' + token}, allow_redirects=False)
response = requests.get(url, headers={'Authorization': 'Bearer ' + token}, params={'private': private},
allow_redirects=False)
if response.status_code == 401:
print(response.content)
return
......@@ -605,7 +606,7 @@ try:
if len(argv) != 2:
display_help()
else:
list(argv[1])
list(argv[1], private)
elif argv[0] == 'help':
display_help()
else:
......
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