Add healthcheck UA to inform server about identity

Adding "healthcheck.io" as User-Agent to inform webhook handler server about request is specific from healthcheck.
This commit is contained in:
Love Sharma 2016-01-22 13:57:20 +08:00
parent 37817fe9b0
commit 35e9c17f74

View File

@ -139,7 +139,8 @@ class Channel(models.Model):
n.save() n.save()
elif self.kind == "webhook" and check.status == "down": elif self.kind == "webhook" and check.status == "down":
try: try:
r = requests.get(self.value, timeout=5) headers = {"User-Agent": "healthchecks.io"}
r = requests.get(self.value, timeout=5, headers=headers)
n.status = r.status_code n.status = r.status_code
except requests.exceptions.Timeout: except requests.exceptions.Timeout:
# Well, we tried # Well, we tried