You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
425 B

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. from django.http import HttpResponse, HttpResponseBadRequest
  2. from django.utils import timezone
  3. from hc.api.models import Check
  4. def ping(request, code):
  5. try:
  6. check = Check.objects.get(code=code)
  7. except Check.DoesNotExist:
  8. return HttpResponseBadRequest()
  9. check.last_ping = timezone.now()
  10. if check.status == "new":
  11. check.status = "up"
  12. check.save()
  13. return HttpResponse("OK")