Skip to content

Commit

Permalink
Change: Ensure HTTP errors are raised on GitHub security API
Browse files Browse the repository at this point in the history
If GitHub returns a http error response ensure that the error is raised
when using the GitHub security API (dependabot, secret scanning, code
scanning).
  • Loading branch information
bjoernricks committed Oct 12, 2023
1 parent b734a69 commit aaa084c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pontos/github/api/code_scanning.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ async def _alerts(
params["direction"] = enum_or_value(direction)

async for response in self._client.get_all(api, params=params):
response.raise_for_status()

for alert in response.json():
yield CodeScanningAlert.from_dict(alert)

Expand Down
2 changes: 2 additions & 0 deletions pontos/github/api/dependabot.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ async def _alerts(
params["direction"] = enum_or_value(direction)

async for response in self._client.get_all(api, params=params):
response.raise_for_status()

for alert in response.json():
yield DependabotAlert.from_dict(alert)

Expand Down
4 changes: 4 additions & 0 deletions pontos/github/api/secret_scanning.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ async def _alerts(
params["direction"] = enum_or_value(direction)

async for response in self._client.get_all(api, params=params):
response.raise_for_status()

for alert in response.json():
yield SecretScanningAlert.from_dict(alert)

Expand Down Expand Up @@ -353,6 +355,8 @@ async def locations(
params = {"per_page": "100"}

async for response in self._client.get_all(api, params=params):
response.raise_for_status()

for location in response.json():
location_type = location["type"]
location_details = location["details"]
Expand Down

0 comments on commit aaa084c

Please sign in to comment.