-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a5dce8
commit 34c6844
Showing
1 changed file
with
5 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -461,7 +461,7 @@ def __arlas__(arlas: str, suffix, post=None, put=None, patch=None, delete=None, | |
if delete: | ||
method = "DELETE" | ||
r: requests.Response = Service.__request__(url, method, data, __headers__) | ||
if r.ok: | ||
if r.status_code >= 200 and r.status_code < 300: | ||
return r.json() | ||
else: | ||
print("Error: request {} failed with status {}: {}".format(method, str(r.status_code), str(r.reason)), file=sys.stderr) | ||
|
@@ -496,12 +496,14 @@ def __es__(arlas: str, suffix, post=None, put=None, delete=None, exit_on_failure | |
if delete is not None: | ||
method = "DELETE" | ||
r: requests.Response = Service.__request__(url, method, data, __headers, auth) | ||
if r.ok: | ||
if r.status_code >= 200 and r.status_code < 300: | ||
return r.content | ||
elif exit_on_failure: | ||
print("Error: request {} failed with status {}: {}".format(method, str(r.status_code), str(r.reason)), file=sys.stderr) | ||
print(" url: {}".format(url), file=sys.stderr) | ||
print(r.content) | ||
if r.status_code == 403: | ||
print("IMPORTANT: This error occurs because you are not allowed to trigger this action. If you are using ARLAS Cloud, please check that you have not used up your quota. You can contact [email protected] for help.", file=sys.stderr) | ||
exit(1) | ||
else: | ||
raise RequestException(r.status_code, r.content) | ||
|
@@ -533,7 +535,7 @@ def __fetch__(resource: Resource, bytes: bool = False): | |
content = f.read() | ||
return content | ||
r: requests.Response = requests.get(resource.location, headers=resource.headers, verify=False) | ||
if r.ok: | ||
if r.status_code >= 200 and r.status_code < 300: | ||
return r.content | ||
else: | ||
print("Error: request failed with status {}: {}".format(str(r.status_code), str(r.reason)), file=sys.stderr) | ||
|