Skip to content

Commit

Permalink
increase timeout to 20 s
Browse files Browse the repository at this point in the history
  • Loading branch information
jnussbaum committed Nov 21, 2023
1 parent f609b67 commit fbb29a8
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion dsp_permissions_scripts/ap/ap_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def _delete_ap_on_server(
protocol = get_protocol(host)
url = f"{protocol}://{host}/admin/permissions/{ap_iri}"
response = http_call_with_retry(
action=lambda: requests.delete(url, headers=headers, timeout=10),
action=lambda: requests.delete(url, headers=headers, timeout=20),
err_msg=f"Could not delete Administrative Permission {ap.iri}",
)
if response.status_code != 200:
Expand Down
2 changes: 1 addition & 1 deletion dsp_permissions_scripts/ap/ap_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _get_all_aps_of_project(
protocol = get_protocol(host)
url = f"{protocol}://{host}/admin/permissions/ap/{project_iri}"
response = http_call_with_retry(
action=lambda: requests.get(url, headers=headers, timeout=10),
action=lambda: requests.get(url, headers=headers, timeout=20),
err_msg=f"Could not get APs of project {project_iri}",
)
if response.status_code != 200:
Expand Down
2 changes: 1 addition & 1 deletion dsp_permissions_scripts/ap/ap_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def _update_ap_on_server(
url = f"{protocol}://{host}/admin/permissions/{iri}/hasPermissions"
payload = {"hasPermissions": create_admin_route_object_from_ap(ap)["hasPermissions"]}
response = http_call_with_retry(
action=lambda: requests.put(url, headers=headers, json=payload, timeout=10),
action=lambda: requests.put(url, headers=headers, json=payload, timeout=20),
err_msg=f"Could not update Administrative Permission {ap.iri}",
)
if response.status_code != 200:
Expand Down
2 changes: 1 addition & 1 deletion dsp_permissions_scripts/doap/doap_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _get_all_doaps_of_project(
protocol = get_protocol(host)
url = f"{protocol}://{host}/admin/permissions/doap/{project_iri}"
response = http_call_with_retry(
action=lambda: requests.get(url, headers=headers, timeout=10),
action=lambda: requests.get(url, headers=headers, timeout=20),
err_msg=f"Error while getting DOAPs of project {project_iri}",
)
if response.status_code != 200:
Expand Down
2 changes: 1 addition & 1 deletion dsp_permissions_scripts/doap/doap_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def _update_doap_scope_on_server(
url = f"{protocol}://{host}/admin/permissions/{iri}/hasPermissions"
payload = {"hasPermissions": create_admin_route_object_from_scope(scope)}
response = http_call_with_retry(
action=lambda: requests.put(url, headers=headers, json=payload, timeout=10),
action=lambda: requests.put(url, headers=headers, json=payload, timeout=20),
err_msg=f"Could not update scope of DOAP {doap_iri}",
)
if response.status_code != 200:
Expand Down
2 changes: 1 addition & 1 deletion dsp_permissions_scripts/oap/oap_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def get_resource(
url = f"{protocol}://{host}/v2/resources/{iri}"
headers = {"Authorization": f"Bearer {token}"}
response = http_call_with_retry(
action=lambda: requests.get(url, headers=headers, timeout=10),
action=lambda: requests.get(url, headers=headers, timeout=20),
err_msg=f"Error while getting resource {resource_iri}",
)
if response.status_code != 200:
Expand Down
4 changes: 2 additions & 2 deletions dsp_permissions_scripts/oap/oap_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _update_permissions_for_value(
url = f"{protocol}://{host}/v2/values"
headers = {"Authorization": f"Bearer {token}"}
response = http_call_with_retry(
action=lambda: requests.put(url, headers=headers, json=payload, timeout=10),
action=lambda: requests.put(url, headers=headers, json=payload, timeout=20),
err_msg=f"Error while updating permissions of resource {resource_iri}, value {value.value_iri}",
)
if response.status_code == 400 and response.text:
Expand Down Expand Up @@ -102,7 +102,7 @@ def _update_permissions_for_resource(
url = f"{protocol}://{host}/v2/resources"
headers = {"Authorization": f"Bearer {token}"}
response = http_call_with_retry(
action=lambda: requests.put(url, headers=headers, json=payload, timeout=10),
action=lambda: requests.put(url, headers=headers, json=payload, timeout=20),
err_msg=f"ERROR while updating permissions of resource {resource_iri}",
)
if response.status_code != 200:
Expand Down
2 changes: 1 addition & 1 deletion dsp_permissions_scripts/utils/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def _get_token(host: str, email: str, pw: str) -> str:
"""Requests an access token from DSP-API"""
protocol = get_protocol(host)
url = f"{protocol}://{host}/v2/authentication"
response = requests.post(url, json={"email": email, "password": pw}, timeout=10)
response = requests.post(url, json={"email": email, "password": pw}, timeout=20)
if response.status_code != 200:
raise ApiError("Could not login", response.text, response.status_code)
token: str = response.json()["token"]
Expand Down
6 changes: 3 additions & 3 deletions dsp_permissions_scripts/utils/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def _get_onto_iris_of_project(
url = f"{protocol}://{host}/v2/ontologies/metadata"
headers = {"Authorization": f"Bearer {token}"}
response = http_call_with_retry(
action=lambda: requests.get(url, headers=headers, timeout=10),
action=lambda: requests.get(url, headers=headers, timeout=20),
err_msg="Could not get onto IRIs",
)
if response.status_code != 200:
Expand All @@ -39,7 +39,7 @@ def _get_class_iris_of_onto(
url = f"{protocol}://{host}/v2/ontologies/allentities/{quote_plus(onto_iri)}"
headers = {"Authorization": f"Bearer {token}"}
response = http_call_with_retry(
action=lambda: requests.get(url, headers=headers, timeout=10),
action=lambda: requests.get(url, headers=headers, timeout=20),
err_msg="Could not get class IRIs",
)
if response.status_code != 200:
Expand Down Expand Up @@ -78,7 +78,7 @@ def get_project_iri_by_shortcode(shortcode: str, host: str) -> str:
protocol = get_protocol(host)
url = f"{protocol}://{host}/admin/projects/shortcode/{shortcode}"
response = http_call_with_retry(
action=lambda: requests.get(url, timeout=10),
action=lambda: requests.get(url, timeout=20),
err_msg="Cannot retrieve project IRI",
)
if response.status_code != 200:
Expand Down

0 comments on commit fbb29a8

Please sign in to comment.