Skip to content

Commit

Permalink
1.0.2 Extend timeout of API calls
Browse files Browse the repository at this point in the history
  • Loading branch information
EricFernandezSnyk committed Aug 17, 2022
1 parent 1164bf0 commit bf1d3dd
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "snyk-tags"
version = "1.0.1"
version = "1.0.2"
description = "CLI tool designed to manage tags and attributes at scale"
authors = ["EricFernandezSnyk <[email protected]>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion snyk_tags/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# snyk_tags/__init__.py

__app_name__ = "snyk_tags"
__version__ = "1.0.1"
__version__ = "1.0.2"

from logging import ERROR
from sre_constants import SUCCESS
Expand Down
8 changes: 5 additions & 3 deletions snyk_tags/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ def apply_tag_to_project(
"value": tag,
}

req = client.post(f"org/{org_id}/project/{project_id}/tags", data=tag_data)
req = client.post(
f"org/{org_id}/project/{project_id}/tags", data=tag_data, timeout=None
)

if req.status_code == 200:
logging.info(f"Successfully added {tag_data} tags to Project: {project_name}.")
Expand All @@ -58,7 +60,7 @@ def apply_tags_to_projects(
) -> None:
with create_client(token=token) as client:
for org_id in org_ids:
projects = client.post(f"org/{org_id}/projects").json()
projects = client.post(f"org/{org_id}/projects", timeout=None).json()
badname = 0
rightname = 0
for project in projects.get("projects"):
Expand Down Expand Up @@ -87,7 +89,7 @@ def apply_github_owner_to_repo(
g = Github(githubtoken)
with create_client(token=snyktoken) as client:
for org_id in org_ids:
projects = client.post(f"org/{org_id}/projects").json()
projects = client.post(f"org/{org_id}/projects", timeout=None).json()
badname = 0
rightname = 0
for project in projects.get("projects"):
Expand Down
2 changes: 1 addition & 1 deletion snyk_tags/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def create_client(token: str) -> httpx.Client:
def find_tags(token: str, group_id: str, jsonflag: bool) -> tuple:
with create_client(token=token) as client:
req = client.get(f"group/{group_id}/tags")
group = client.get(f"group/{group_id}/orgs").json()
group = client.get(f"group/{group_id}/orgs", timeout=None).json()
group_name = group["name"]
if req.status_code == 200:
if jsonflag is False:
Expand Down
2 changes: 1 addition & 1 deletion snyk_tags/remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def remove_tag_from_group(
tag_data = {"key": key, "value": tag}

with create_client(token=token) as client:
req = client.post(f"group/{group_id}/tags/delete", data=tag_data)
req = client.post(f"group/{group_id}/tags/delete", data=tag_data, timeout=None)
group = client.get(f"group/{group_id}/orgs").json()
group_name = group["name"]

Expand Down
8 changes: 5 additions & 3 deletions snyk_tags/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def create_client(token: str) -> httpx.Client:
def get_org_ids(token: str, group_id: str) -> list:
org_ids = []
with create_client(token=token) as client:
req = client.get(f"group/{group_id}/orgs")
req = client.get(f"group/{group_id}/orgs", timeout=None)
if req.status_code == 404:
logging.error(
f"Group id: {group_id} is invalid. Error message: {req.json()}."
Expand All @@ -52,7 +52,9 @@ def apply_tag_to_project(
"key": key,
"value": tag,
}
req = client.post(f"org/{org_id}/project/{project_id}/tags", data=tag_data)
req = client.post(
f"org/{org_id}/project/{project_id}/tags", data=tag_data, timeout=None
)

if req.status_code == 200:
logging.info(f"Successfully added {tag} tags to Project: {project_name}.")
Expand All @@ -70,7 +72,7 @@ def apply_tags_to_projects(
) -> None:
with create_client(token=token) as client:
for org_id in org_ids:
projects = client.post(f"org/{org_id}/projects").json()
projects = client.post(f"org/{org_id}/projects", timeout=None).json()
for project in projects.get("projects"):
for type in types:
if project["type"] == type:
Expand Down

0 comments on commit bf1d3dd

Please sign in to comment.