Skip to content

Commit

Permalink
chore: lint pr
Browse files Browse the repository at this point in the history
Signed-off-by: 35C4n0r <[email protected]>
  • Loading branch information
35C4n0r committed Oct 26, 2024
1 parent e674243 commit b2b11ce
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions keep/providers/graylog_provider/graylog_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@
Graylog Provider is a class that allows to install webhooks in Graylog.
"""

import ast
import dataclasses
import json
import math
import uuid
from datetime import datetime, timezone, timedelta
from pathlib import Path
from typing import List
from urllib.parse import urlencode, urljoin, urlparse

import pydantic
import requests
from requests import HTTPError

from keep.api.models.alert import AlertDto, AlertSeverity, AlertStatus
from keep.contextmanager.contextmanager import ContextManager
Expand Down Expand Up @@ -130,7 +126,7 @@ def graylog_host(self):
self._host = f"http://{self.authentication_config.deploymentUrl}"
except Exception as e:
self.logger.error(
f"Failed to determine Graylog host", extra={"exception": str(e)}
"Failed to determine Graylog host", extra={"exception": str(e)}
)
self._host = self.authentication_config.deploymentUrl.rstrip("/")

Expand Down Expand Up @@ -192,7 +188,7 @@ def validate_scopes(self) -> dict[str, bool | str]:

except Exception as e:
self.logger.error(
f"Error while validating user scopes", extra={"exception": str(e)}
"Error while validating user scopes", extra={"exception": str(e)}
)
authenticated = str(e)
authorized = False
Expand All @@ -217,7 +213,7 @@ def __get_url_whitelist(self):
return whitelist_response.json()
except Exception as e:
self.logger.error(
f"Error while fetching URL whitelist", extra={"exception": str(e)}
"Error while fetching URL whitelist", extra={"exception": str(e)}
)
raise e

Expand All @@ -235,7 +231,7 @@ def __update_url_whitelist(self, whitelist):
self.logger.info("Successfully updated URL whitelist")
except Exception as e:
self.logger.error(
f"Error while updating URL whitelist", extra={"exception": str(e)}
"Error while updating URL whitelist", extra={"exception": str(e)}
)
raise e

Expand All @@ -260,7 +256,7 @@ def __get_events(self, page: int, per_page: int):

except Exception as e:
self.logger.error(
f"Error while fetching events", extra={"exception": str(e)}
"Error while fetching events", extra={"exception": str(e)}
)
raise e

Expand Down Expand Up @@ -472,7 +468,7 @@ def setup_webhook(
self.logger.info("Webhook setup completed successfully")
except Exception as e:
self.logger.error(
f"Error while setting up webhook", extra={"exception": str(e)}
"Error while setting up webhook", extra={"exception": str(e)}
)
raise e

Expand Down Expand Up @@ -570,7 +566,7 @@ def __get_alerts(self, json_data: dict):

except Exception as e:
self.logger.error(
f"Error while fetching alerts", extra={"exception": str(e)}
"Error while fetching alerts", extra={"exception": str(e)}
)
raise e

Expand Down

0 comments on commit b2b11ce

Please sign in to comment.