Compare commits
No commits in common. "12b41683099db0699b358bb8be51202e922d2660" and "927738ec71f81ca3f4f74c02c5d24c3c4103f688" have entirely different histories.
12b4168309
...
927738ec71
2 changed files with 2 additions and 11 deletions
|
@ -29,6 +29,7 @@ def hydrate_http_probes(tree, excludes=[]):
|
||||||
headers = probe.kwargs.get("headers", None)
|
headers = probe.kwargs.get("headers", None)
|
||||||
body = probe.kwargs.get("body", None)
|
body = probe.kwargs.get("body", None)
|
||||||
content = requests.request(method, url, headers=headers, data=body).text
|
content = requests.request(method, url, headers=headers, data=body).text
|
||||||
|
print(len(content))
|
||||||
m = re.search("<title>(.*?)</title>", content)
|
m = re.search("<title>(.*?)</title>", content)
|
||||||
if m is None:
|
if m is None:
|
||||||
logger.info(f"Didn't find keywords for probe {probe.name}, skipping")
|
logger.info(f"Didn't find keywords for probe {probe.name}, skipping")
|
||||||
|
|
|
@ -88,7 +88,6 @@ class Monitor(Item):
|
||||||
def save(self):
|
def save(self):
|
||||||
if self.saved:
|
if self.saved:
|
||||||
return
|
return
|
||||||
logger.debug(f"Saving {repr(self)}")
|
|
||||||
for t, _ in self.tags:
|
for t, _ in self.tags:
|
||||||
t.save()
|
t.save()
|
||||||
for n in self.notifications:
|
for n in self.notifications:
|
||||||
|
@ -113,8 +112,7 @@ class Monitor(Item):
|
||||||
(i["tag_id"], i["value"]) for i in self.api.get_monitor(self.id)["tags"]
|
(i["tag_id"], i["value"]) for i in self.api.get_monitor(self.id)["tags"]
|
||||||
)
|
)
|
||||||
for t, v in self.tags:
|
for t, v in self.tags:
|
||||||
if (t.id, v) not in current_tags:
|
if (t, v) not in current_tags:
|
||||||
logger.debug(f"Adding tag: '{t}, {v}'")
|
|
||||||
self.api.add_monitor_tag(tag_id=t.id, monitor_id=self.id, value=v)
|
self.api.add_monitor_tag(tag_id=t.id, monitor_id=self.id, value=v)
|
||||||
self.saved = True
|
self.saved = True
|
||||||
|
|
||||||
|
@ -131,7 +129,6 @@ class Tag(Item):
|
||||||
def save(self):
|
def save(self):
|
||||||
if self.saved:
|
if self.saved:
|
||||||
return
|
return
|
||||||
logger.debug(f"Saving {repr(self)}")
|
|
||||||
if self.id is None:
|
if self.id is None:
|
||||||
rslt = self.api.add_tag(
|
rslt = self.api.add_tag(
|
||||||
name=self.tag,
|
name=self.tag,
|
||||||
|
@ -146,9 +143,6 @@ class Tag(Item):
|
||||||
)
|
)
|
||||||
self.saved = True
|
self.saved = True
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return f"Tag({str(self)})"
|
|
||||||
|
|
||||||
|
|
||||||
class Notification(Item):
|
class Notification(Item):
|
||||||
def __init__(self, api, name, id=None, old_name=None, **kwargs):
|
def __init__(self, api, name, id=None, old_name=None, **kwargs):
|
||||||
|
@ -158,7 +152,6 @@ class Notification(Item):
|
||||||
def save(self):
|
def save(self):
|
||||||
if self.saved:
|
if self.saved:
|
||||||
return
|
return
|
||||||
logger.debug(f"Saving {repr(self)}")
|
|
||||||
if self.id is None:
|
if self.id is None:
|
||||||
rslt = self.api.add_notification(
|
rslt = self.api.add_notification(
|
||||||
name=self.name,
|
name=self.name,
|
||||||
|
@ -172,6 +165,3 @@ class Notification(Item):
|
||||||
**self.kwargs,
|
**self.kwargs,
|
||||||
)
|
)
|
||||||
self.saved = True
|
self.saved = True
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return f"Notification({str(self)})"
|
|
||||||
|
|
Loading…
Reference in a new issue