Skip to content

Commit

Permalink
Add bandit
Browse files Browse the repository at this point in the history
  • Loading branch information
vuilleumierc committed Sep 11, 2024
1 parent de10f77 commit d706e15
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ repos:
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/PyCQA/bandit
rev: 1.7.9
hooks:
- id: bandit
args: ["-c", "pyproject.toml"]
additional_dependencies: ["bandit[toml]"]

ci:
autoupdate_schedule: quarterly
skip:
Expand Down
2 changes: 1 addition & 1 deletion geoservercloud/geoservercloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(
self,
url: str = "http://localhost:9090/geoserver/cloud/",
user: str = "admin",
password: str = "geoserver",
password: str = "geoserver", # nosec
) -> None:

self.url: str = url
Expand Down
6 changes: 6 additions & 0 deletions geoservercloud/restservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import requests

TIMEOUT = 120


class RestService:
def __init__(self, url: str, auth: tuple[str, str]) -> None:
Expand All @@ -19,6 +21,7 @@ def get(
params=params,
headers=headers,
auth=self.auth,
timeout=TIMEOUT,
)
if response.status_code != 404:
response.raise_for_status()
Expand All @@ -40,6 +43,7 @@ def post(
json=json,
data=data,
auth=self.auth,
timeout=TIMEOUT,
)
if response.status_code != 409:
response.raise_for_status()
Expand All @@ -60,6 +64,7 @@ def put(
json=json,
data=data,
auth=self.auth,
timeout=TIMEOUT,
)
response.raise_for_status()
return response
Expand All @@ -75,6 +80,7 @@ def delete(
params=params,
headers=headers,
auth=self.auth,
timeout=TIMEOUT,
)
if response.status_code != 404:
response.raise_for_status()
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ fix-shallow-repository = true

[tool.poetry-plugin-tweak-dependencies-version]
default = "present"

[tool.bandit]
exclude_dirs = ["tests"]

0 comments on commit d706e15

Please sign in to comment.