from urllib.parse import quote, unquote from django.urls import path, register_converter from hc.api import views class QuoteConverter: regex = "[\w%~_.-]+" def to_python(self, value): return unquote(value) def to_url(self, value): return quote(value, safe="") register_converter(QuoteConverter, "quoted") urlpatterns = [ path("ping//", views.ping, name="hc-ping-slash"), path("ping/", views.ping, name="hc-ping"), path("ping//fail", views.ping, {"action": "fail"}, name="hc-fail"), path("ping//start", views.ping, {"action": "start"}, name="hc-start"), path("api/v1/checks/", views.checks), path("api/v1/checks/", views.single, name="hc-api-single"), path("api/v1/checks//pause", views.pause, name="hc-api-pause"), path("api/v1/notifications//bounce", views.bounce, name="hc-api-bounce"), path("api/v1/channels/", views.channels), path( "badge///.", views.badge, name="hc-badge", ), path( "badge//.", views.badge, {"tag": "*"}, name="hc-badge-all", ), path("api/v1/status/", views.status), ]