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

BIOMASS-3094-s3-Authz show error for HTTP 403

parent 41990cdd
No related branches found
No related tags found
1 merge request!7BIOMASS-3094-s3-Authz show error for HTTP 403
......@@ -242,7 +242,7 @@ def upload(sourceFile, destination, private: bool):
response = requests.put(url, headers={'Authorization': 'Bearer ' + token},
params={'private': private}, allow_redirects=False)
if response.status_code == 401:
if response.status_code == 401 or response.status_code == 403:
print(response.content)
sys.exit(1)
location = response.headers['Location']
......@@ -293,7 +293,7 @@ def upload_multipart(sourceFile, destination, private_bucket: bool):
url = "https://gravitee-gateway."+MAAP_ENV_TYPE.lower()+".esa-maap.org/s3/generateUploadId"
params={'bucketName': bucketName, 'objectKey': key, 'private': private_bucket}
response = requests.get(url, params=params, headers={'Authorization': 'Bearer ' + token})
if response.status_code == 401:
if response.status_code == 401 or response.status_code == 403:
print(response.content)
sys.exit(1)
......@@ -306,7 +306,7 @@ def upload_multipart(sourceFile, destination, private_bucket: bool):
params = {'bucketName': bucketName, 'objectKey': key, 'nbParts': nbParts, 'uploadId': uploadId,
'private': private_bucket}
response = requests.get(url, params = params, headers = {'Authorization': 'Bearer '+token})
if response.status_code == 401:
if response.status_code == 401 or response.status_code == 403:
print(response.content)
sys.exit(1)
......@@ -334,7 +334,7 @@ def upload_multipart(sourceFile, destination, private_bucket: bool):
time.sleep(60)
resume()
if response.status_code == 401:
if response.status_code == 401 or response.status_code == 403:
print(response.content)
sys.exit(1)
#print(response.headers)
......@@ -423,7 +423,7 @@ def resume():
params = {'bucketName': bucketName, 'objectKey': key, 'nbParts': nbParts, 'uploadId': uploadId,
'private': isPrivate}
response = requests.get(url, params = params, headers = {'Authorization': 'Bearer '+token})
if response.status_code == 401:
if response.status_code == 401 or response.status_code == 403:
print(response.content)
sys.exit(1)
......@@ -527,7 +527,7 @@ def delete(destination, private):
headers={'Authorization': 'Bearer ' + token},
params={'private': str(private)},
allow_redirects=False)
if response.status_code == 401:
if response.status_code == 401 or response.status_code == 403:
print(response.content)
sys.exit(1)
......@@ -563,7 +563,7 @@ def download(path, name, private: bool):
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)},
allow_redirects=False)
if response.status_code == 401:
if response.status_code == 401 or response.status_code == 403:
print(response.content)
sys.exit(1)
location = response.headers['Location']
......
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