Skip to content

Commit

Permalink
fix: fix issue where issue_counts not being present raises an unhandl… (
Browse files Browse the repository at this point in the history
#197)

* fix: fix issue where issue_counts not being present raises an unhandled exception

* chore: bump version
  • Loading branch information
nathan-roys authored Sep 25, 2023
1 parent d3abf4b commit 4cb2c1e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 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 = "pysnyk"
version = "0.9.13"
version = "0.9.14"
description = "A Python client for the Snyk API"
authors = [
"Gareth Rushgrove <[email protected]>",
Expand Down
10 changes: 5 additions & 5 deletions snyk/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def _rest_to_v1_response_format(self, project):
attributes = project.get("attributes", {})
settings = attributes.get("settings", {})
recurring_tests = settings.get("recurring_tests", {})
issue_counts = project.get("meta", {}).get("latest_issue_counts")
issue_counts = project.get("meta", {}).get("latest_issue_counts", {})
remote_repo_url = (
project.get("relationships", {})
.get("target", {})
Expand All @@ -161,10 +161,10 @@ def _rest_to_v1_response_format(self, project):
"testFrequency": recurring_tests.get("frequency"),
"isMonitored": True if attributes.get("status") == "active" else False,
"issueCountsBySeverity": {
"low": issue_counts.get("low"),
"medium": issue_counts.get("medium"),
"high": issue_counts.get("high"),
"critical": issue_counts.get("critical"),
"low": issue_counts.get("low", 0),
"medium": issue_counts.get("medium", 0),
"high": issue_counts.get("high", 0),
"critical": issue_counts.get("critical", 0),
},
"targetReference": attributes.get("target_reference"),
"branch": attributes.get("target_reference"),
Expand Down

0 comments on commit 4cb2c1e

Please sign in to comment.