Skip to content

Commit a2a2519

Browse files
authored
fix: site 24x7 (#5274)
1 parent 0c82d98 commit a2a2519

File tree

2 files changed

+21
-26
lines changed

2 files changed

+21
-26
lines changed

keep/providers/site24x7_provider/site24x7_provider.py

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -149,34 +149,29 @@ def __get_headers(self):
149149
}
150150

151151
def validate_scopes(self) -> dict[str, bool | str]:
152-
valid_tlds = [".com", ".eu", ".com.cn", ".in", ".com.au", ".jp"]
153-
valid_tld_scope = "TLD not in [.com | .eu | .com.cn | .in | .com.au | .jp]"
154-
authentication_scope = "Validate TLD first"
155-
if self.authentication_config.zohoAccountTLD in valid_tlds:
156-
valid_tld_scope = True
157-
response = requests.get(
158-
f'{self.__get_url(paths=["monitors"])}', headers=self.__get_headers()
152+
response = requests.get(
153+
f'{self.__get_url(paths=["monitors"])}', headers=self.__get_headers()
154+
)
155+
if response.status_code == 401:
156+
authentication_scope = response.json()
157+
self.logger.error(
158+
"Failed to authenticate user",
159+
extra={"response": authentication_scope},
160+
)
161+
elif response.status_code == 200:
162+
authentication_scope = True
163+
self.logger.info("Authenticated user successfully")
164+
else:
165+
authentication_scope = (
166+
f"Error while authenticating user, {response.status_code}"
167+
)
168+
self.logger.error(
169+
"Error while authenticating user",
170+
extra={"status_code": response.status_code},
159171
)
160-
if response.status_code == 401:
161-
authentication_scope = response.json()
162-
self.logger.error(
163-
"Failed to authenticate user",
164-
extra={"response": authentication_scope},
165-
)
166-
elif response.status_code == 200:
167-
authentication_scope = True
168-
self.logger.info("Authenticated user successfully")
169-
else:
170-
authentication_scope = (
171-
f"Error while authenticating user, {response.status_code}"
172-
)
173-
self.logger.error(
174-
"Error while authenticating user",
175-
extra={"status_code": response.status_code},
176-
)
177172
return {
178173
"authenticated": authentication_scope,
179-
"valid_tld": valid_tld_scope,
174+
"valid_tld": True
180175
}
181176

182177
def setup_webhook(

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "keep"
3-
version = "0.47.2"
3+
version = "0.47.3"
44
description = "Alerting. for developers, by developers."
55
authors = ["Keep Alerting LTD"]
66
packages = [{include = "keep"}]

0 commit comments

Comments
 (0)