adopt ruff as the replacement for python black (#332)
This commit is contained in:
@@ -53,7 +53,11 @@ class BitwardenService:
|
||||
"""
|
||||
# Step 1: Set up environment variables and log in
|
||||
try:
|
||||
env = {"BW_CLIENTID": client_id, "BW_CLIENTSECRET": client_secret, "BW_PASSWORD": master_password}
|
||||
env = {
|
||||
"BW_CLIENTID": client_id,
|
||||
"BW_CLIENTSECRET": client_secret,
|
||||
"BW_PASSWORD": master_password,
|
||||
}
|
||||
login_command = ["bw", "login", "--apikey"]
|
||||
login_result = BitwardenService.run_command(login_command, env)
|
||||
|
||||
@@ -81,7 +85,15 @@ class BitwardenService:
|
||||
raise BitwardenUnlockError("Session key is empty.")
|
||||
|
||||
# Step 3: Retrieve the items
|
||||
list_command = ["bw", "list", "items", "--url", url, "--session", session_key]
|
||||
list_command = [
|
||||
"bw",
|
||||
"list",
|
||||
"items",
|
||||
"--url",
|
||||
url,
|
||||
"--session",
|
||||
session_key,
|
||||
]
|
||||
items_result = BitwardenService.run_command(list_command)
|
||||
|
||||
if items_result.stderr and "Event post failed" not in items_result.stderr:
|
||||
@@ -100,7 +112,11 @@ class BitwardenService:
|
||||
totp_result = BitwardenService.run_command(totp_command)
|
||||
|
||||
if totp_result.stderr and "Event post failed" not in totp_result.stderr:
|
||||
LOG.warning("Bitwarden TOTP Error", error=totp_result.stderr, e=BitwardenTOTPError(totp_result.stderr))
|
||||
LOG.warning(
|
||||
"Bitwarden TOTP Error",
|
||||
error=totp_result.stderr,
|
||||
e=BitwardenTOTPError(totp_result.stderr),
|
||||
)
|
||||
totp_code = totp_result.stdout
|
||||
|
||||
credentials: list[dict[str, str]] = [
|
||||
|
||||
@@ -39,7 +39,9 @@ async def get_current_org(
|
||||
)
|
||||
|
||||
|
||||
async def get_current_org_with_api_key(x_api_key: Annotated[str | None, Header()] = None) -> Organization:
|
||||
async def get_current_org_with_api_key(
|
||||
x_api_key: Annotated[str | None, Header()] = None,
|
||||
) -> Organization:
|
||||
if not x_api_key:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_403_FORBIDDEN,
|
||||
@@ -48,7 +50,9 @@ async def get_current_org_with_api_key(x_api_key: Annotated[str | None, Header()
|
||||
return await _get_current_org_cached(x_api_key, app.DATABASE)
|
||||
|
||||
|
||||
async def get_current_org_with_authentication(authorization: Annotated[str | None, Header()] = None) -> Organization:
|
||||
async def get_current_org_with_authentication(
|
||||
authorization: Annotated[str | None, Header()] = None,
|
||||
) -> Organization:
|
||||
if not authorization:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_403_FORBIDDEN,
|
||||
|
||||
@@ -35,5 +35,5 @@ async def create_org_api_token(org_id: str) -> OrganizationAuthToken:
|
||||
token=api_key,
|
||||
token_type=OrganizationAuthTokenType.api,
|
||||
)
|
||||
LOG.info(f"Created API token for organization", organization_id=org_id)
|
||||
LOG.info("Created API token for organization", organization_id=org_id)
|
||||
return org_auth_token
|
||||
|
||||
Reference in New Issue
Block a user