Skip to content

Commit

Permalink
Merge pull request #33 from mam-dev/py312
Browse files Browse the repository at this point in the history
Support Python 3.12
  • Loading branch information
bunny-therapist committed Oct 13, 2023
2 parents b093f2f + dbf6a76 commit 7992f0b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
build:
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10", "3.11"]
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Security",
"License :: OSI Approved :: Apache Software License",
]
Expand Down Expand Up @@ -73,7 +74,7 @@ disallow_untyped_decorators = true
no_implicit_optional = true
no_implicit_reexport = true
strict_equality = true
strict_concatenate = true
extra_checks = true

[tool.ruff]
src = ["src", "test"]
Expand Down
21 changes: 12 additions & 9 deletions src/security_constraints/github_security_advisory.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ def get_vulnerabilities(
after = json_data["securityVulnerabilities"]["pageInfo"]["endCursor"]
except KeyError as missing_key:
error_msg = f"Key {missing_key} not found in: {json_response}"
LOGGER.error(error_msg)
raise FetchVulnerabilitiesError(error_msg) from None

return vulnerabilities
Expand All @@ -138,6 +137,8 @@ def _do_graphql_request(
severities=",".join(sorted([str(severity) for severity in severities])),
additional=f'after:"{after}"' if after is not None else "",
)
LOGGER.debug("GraphQL query: %s", query)
LOGGER.debug("Sending request to %s", self.URL)
response: requests.Response = self._session.post(
url=self.URL,
headers={"Authorization": f"bearer {self._token}"},
Expand All @@ -151,15 +152,17 @@ def _do_graphql_request(
f"Unexpected json data format in response: {json_content}"
)
except requests.HTTPError as error:
LOGGER.error(
"HTTP error (status %s) received from URL %s: %s",
response.status_code,
self.URL,
error,
error_msg = (
"HTTP error (status {status}) received from URL {url}: {err}".format(
status=response.status_code,
url=self.URL,
err=error,
)
)
raise FetchVulnerabilitiesError from error
raise FetchVulnerabilitiesError(error_msg) from error
except requests.JSONDecodeError as error:
LOGGER.error("Could not decode json data in response: %s", response.text)
raise FetchVulnerabilitiesError from error
error_msg = f"Could not decode json data in response: {response.text}"
raise FetchVulnerabilitiesError(error_msg) from error
else:
LOGGER.debug("Request to %s was successful", self.URL)
return json_content
4 changes: 2 additions & 2 deletions src/security_constraints/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ def main() -> int:
output.write(
f"{format_constraints_file_line(constraints, vulnerability)}\n"
)
except SecurityConstraintsError as error:
LOGGER.error(error)
except SecurityConstraintsError:
LOGGER.exception("Program exited with an exception.")
return 1
except Exception as error:
LOGGER.critical(
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py38,py39,py310,py311
envlist = py38,py39,py310,py311,py312
isolated_build = True
minversion = 4.0.0

Expand All @@ -9,6 +9,7 @@ python =
3.9: py39
3.10: py310
3.11: py311
3.12: py312

[testenv]
deps =
Expand Down

0 comments on commit 7992f0b

Please sign in to comment.