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.

47 lines
1.5 KiB

10 years ago
10 years ago
10 years ago
10 years ago
  1. from urllib.parse import quote, unquote
  2. from django.urls import path, register_converter
  3. from hc.api import views
  4. class QuoteConverter:
  5. regex = '[\w%~_.-]+'
  6. def to_python(self, value):
  7. return unquote(value)
  8. def to_url(self, value):
  9. return quote(value, safe="")
  10. register_converter(QuoteConverter, 'quoted')
  11. urlpatterns = [
  12. path('ping/<uuid:code>/', views.ping, name="hc-ping-slash"),
  13. path('ping/<uuid:code>', views.ping, name="hc-ping"),
  14. path('ping/<uuid:code>/fail', views.ping, {"action": "fail"}, name="hc-fail"),
  15. path('ping/<uuid:code>/start', views.ping, {"action": "start"}, name="hc-start"),
  16. path('api/v1/checks/', views.checks),
  17. path('api/v1/checks/<uuid:code>', views.update, name="hc-api-update"),
  18. path('api/v1/checks/<uuid:code>/pause', views.pause, name="hc-api-pause"),
  19. path('api/v1/notifications/<uuid:code>/bounce', views.bounce,
  20. name="hc-api-bounce"),
  21. path('api/v1/channels/', views.channels),
  22. path('badge/<slug:badge_key>/<slug:signature>/<quoted:tag>.svg', views.badge,
  23. name="hc-badge"),
  24. path('badge/<slug:badge_key>/<slug:signature>.svg', views.badge,
  25. {"tag": "*"}, name="hc-badge-all"),
  26. path('badge/<slug:badge_key>/<slug:signature>/<quoted:tag>.json', views.badge,
  27. {"format": "json"}, name="hc-badge-json"),
  28. path('badge/<slug:badge_key>/<slug:signature>.json', views.badge,
  29. {"format": "json", "tag": "*"}, name="hc-badge-json-all"),
  30. path('api/v1/status/', views.status),
  31. ]