mirror of https://github.com/zulip/zulip.git
webhooks: Rename api_key_only_webhook_view to webhook_view.
There are no other types of webhook views; this is more concise.
This commit is contained in:
parent
8cfacbf8aa
commit
cf6ebb9c8d
|
@ -26,7 +26,7 @@ other integrations generally should set the first User-Agent element
|
||||||
on their HTTP requests to something of the form
|
on their HTTP requests to something of the form
|
||||||
ZulipIntegrationName/1.2 so that they are categorized properly.
|
ZulipIntegrationName/1.2 so that they are categorized properly.
|
||||||
|
|
||||||
The `api_key_only_webhook_view` auth decorator, used for most incoming
|
The `webhook_view` auth decorator, used for most incoming
|
||||||
webhooks, accepts the name of the integration as an argument and uses
|
webhooks, accepts the name of the integration as an argument and uses
|
||||||
it to generate a client name that it adds to the `request` (Django
|
it to generate a client name that it adds to the `request` (Django
|
||||||
[HttpRequest](https://docs.djangoproject.com/en/1.8/ref/request-response/#django.http.HttpRequest))
|
[HttpRequest](https://docs.djangoproject.com/en/1.8/ref/request-response/#django.http.HttpRequest))
|
||||||
|
|
|
@ -336,11 +336,11 @@ expect that the webhook for a service will allow specification for the
|
||||||
target server for the webhook, and an API key.
|
target server for the webhook, and an API key.
|
||||||
|
|
||||||
If the webhook does not have an option to provide a bot email, use the
|
If the webhook does not have an option to provide a bot email, use the
|
||||||
`api_key_only_webhook_view` decorator, to fill in the `user_profile` and
|
`webhook_view` decorator, to fill in the `user_profile` and
|
||||||
`request.client` fields of a request:
|
`request.client` fields of a request:
|
||||||
|
|
||||||
``` py
|
``` py
|
||||||
@api_key_only_webhook_view('PagerDuty')
|
@webhook_view('PagerDuty')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_pagerduty_webhook(request, user_profile,
|
def api_pagerduty_webhook(request, user_profile,
|
||||||
payload=REQ(argument_type='body'),
|
payload=REQ(argument_type='body'),
|
||||||
|
|
|
@ -86,14 +86,14 @@ from typing import Any, Dict, Iterable, Optional
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_error, json_success
|
from zerver.lib.response import json_error, json_success
|
||||||
from zerver.lib.validator import check_dict, check_string
|
from zerver.lib.validator import check_dict, check_string
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
@api_key_only_webhook_view('HelloWorld')
|
@webhook_view('HelloWorld')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_helloworld_webhook(
|
def api_helloworld_webhook(
|
||||||
request: HttpRequest, user_profile: UserProfile,
|
request: HttpRequest, user_profile: UserProfile,
|
||||||
|
@ -116,21 +116,21 @@ def api_helloworld_webhook(
|
||||||
```
|
```
|
||||||
|
|
||||||
The above code imports the required functions and defines the main webhook
|
The above code imports the required functions and defines the main webhook
|
||||||
function `api_helloworld_webhook`, decorating it with `api_key_only_webhook_view` and
|
function `api_helloworld_webhook`, decorating it with `webhook_view` and
|
||||||
`has_request_variables`. The `has_request_variables` decorator allows you to
|
`has_request_variables`. The `has_request_variables` decorator allows you to
|
||||||
access request variables with `REQ()`. You can find more about `REQ` and request
|
access request variables with `REQ()`. You can find more about `REQ` and request
|
||||||
variables in [Writing views](
|
variables in [Writing views](
|
||||||
https://zulip.readthedocs.io/en/latest/tutorials/writing-views.html#request-variables).
|
https://zulip.readthedocs.io/en/latest/tutorials/writing-views.html#request-variables).
|
||||||
|
|
||||||
You must pass the name of your integration to the
|
You must pass the name of your integration to the
|
||||||
`api_key_only_webhook_view` decorator; that name will be used to
|
`webhook_view` decorator; that name will be used to
|
||||||
describe your integration in Zulip's analytics (e.g. the `/stats`
|
describe your integration in Zulip's analytics (e.g. the `/stats`
|
||||||
page). Here we have used `HelloWorld`. To be consistent with other
|
page). Here we have used `HelloWorld`. To be consistent with other
|
||||||
integrations, use the name of the product you are integrating in camel
|
integrations, use the name of the product you are integrating in camel
|
||||||
case, spelled as the product spells its own name (except always first
|
case, spelled as the product spells its own name (except always first
|
||||||
letter upper-case).
|
letter upper-case).
|
||||||
|
|
||||||
The `api_key_only_webhook_view` decorator indicates that the 3rd party service will
|
The `webhook_view` decorator indicates that the 3rd party service will
|
||||||
send the authorization as an API key in the query parameters. If your service uses
|
send the authorization as an API key in the query parameters. If your service uses
|
||||||
HTTP Basic authentication, you would instead use the `authenticated_rest_api_view`
|
HTTP Basic authentication, you would instead use the `authenticated_rest_api_view`
|
||||||
decorator.
|
decorator.
|
||||||
|
|
|
@ -320,7 +320,7 @@ def full_webhook_client_name(raw_client_name: Optional[str]=None) -> Optional[st
|
||||||
return f"Zulip{raw_client_name}Webhook"
|
return f"Zulip{raw_client_name}Webhook"
|
||||||
|
|
||||||
# Use this for webhook views that don't get an email passed in.
|
# Use this for webhook views that don't get an email passed in.
|
||||||
def api_key_only_webhook_view(
|
def webhook_view(
|
||||||
webhook_client_name: str,
|
webhook_client_name: str,
|
||||||
notify_bot_owner_on_invalid_json: bool=True,
|
notify_bot_owner_on_invalid_json: bool=True,
|
||||||
) -> Callable[[Callable[..., HttpResponse]], Callable[..., HttpResponse]]:
|
) -> Callable[[Callable[..., HttpResponse]], Callable[..., HttpResponse]]:
|
||||||
|
|
|
@ -13,7 +13,6 @@ from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.timezone import now as timezone_now
|
from django.utils.timezone import now as timezone_now
|
||||||
|
|
||||||
from zerver.decorator import (
|
from zerver.decorator import (
|
||||||
api_key_only_webhook_view,
|
|
||||||
authenticate_notify,
|
authenticate_notify,
|
||||||
authenticated_json_view,
|
authenticated_json_view,
|
||||||
authenticated_rest_api_view,
|
authenticated_rest_api_view,
|
||||||
|
@ -25,6 +24,7 @@ from zerver.decorator import (
|
||||||
rate_limit,
|
rate_limit,
|
||||||
return_success_on_head_request,
|
return_success_on_head_request,
|
||||||
validate_api_key,
|
validate_api_key,
|
||||||
|
webhook_view,
|
||||||
zulip_login_required,
|
zulip_login_required,
|
||||||
)
|
)
|
||||||
from zerver.forms import OurAuthenticationForm
|
from zerver.forms import OurAuthenticationForm
|
||||||
|
@ -259,16 +259,16 @@ class DecoratorTestCase(ZulipTestCase):
|
||||||
request.body = '{"a": "b"}'
|
request.body = '{"a": "b"}'
|
||||||
self.assertEqual(get_payload(request), {'a': 'b'})
|
self.assertEqual(get_payload(request), {'a': 'b'})
|
||||||
|
|
||||||
def test_api_key_only_webhook_view(self) -> None:
|
def test_webhook_view(self) -> None:
|
||||||
@api_key_only_webhook_view('ClientName')
|
@webhook_view('ClientName')
|
||||||
def my_webhook(request: HttpRequest, user_profile: UserProfile) -> str:
|
def my_webhook(request: HttpRequest, user_profile: UserProfile) -> str:
|
||||||
return user_profile.email
|
return user_profile.email
|
||||||
|
|
||||||
@api_key_only_webhook_view('ClientName')
|
@webhook_view('ClientName')
|
||||||
def my_webhook_raises_exception(request: HttpRequest, user_profile: UserProfile) -> None:
|
def my_webhook_raises_exception(request: HttpRequest, user_profile: UserProfile) -> None:
|
||||||
raise Exception("raised by webhook function")
|
raise Exception("raised by webhook function")
|
||||||
|
|
||||||
@api_key_only_webhook_view('ClientName')
|
@webhook_view('ClientName')
|
||||||
def my_webhook_raises_exception_unsupported_event(
|
def my_webhook_raises_exception_unsupported_event(
|
||||||
request: HttpRequest, user_profile: UserProfile) -> None:
|
request: HttpRequest, user_profile: UserProfile) -> None:
|
||||||
raise UnsupportedWebhookEventType("helloworld", "test_event")
|
raise UnsupportedWebhookEventType("helloworld", "test_event")
|
||||||
|
|
|
@ -4,7 +4,7 @@ from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import InvalidJSONError, JsonableError
|
from zerver.lib.exceptions import InvalidJSONError, JsonableError
|
||||||
from zerver.lib.send_email import FromAddress
|
from zerver.lib.send_email import FromAddress
|
||||||
from zerver.lib.test_classes import WebhookTestCase, ZulipTestCase
|
from zerver.lib.test_classes import WebhookTestCase, ZulipTestCase
|
||||||
|
@ -58,11 +58,11 @@ class WebhooksCommonTestCase(ZulipTestCase):
|
||||||
self.assertEqual(msg.content, expected_message)
|
self.assertEqual(msg.content, expected_message)
|
||||||
|
|
||||||
def test_notify_bot_owner_on_invalid_json(self) -> None:
|
def test_notify_bot_owner_on_invalid_json(self) -> None:
|
||||||
@api_key_only_webhook_view('ClientName', notify_bot_owner_on_invalid_json=False)
|
@webhook_view('ClientName', notify_bot_owner_on_invalid_json=False)
|
||||||
def my_webhook_no_notify(request: HttpRequest, user_profile: UserProfile) -> None:
|
def my_webhook_no_notify(request: HttpRequest, user_profile: UserProfile) -> None:
|
||||||
raise InvalidJSONError("Malformed JSON")
|
raise InvalidJSONError("Malformed JSON")
|
||||||
|
|
||||||
@api_key_only_webhook_view('ClientName', notify_bot_owner_on_invalid_json=True)
|
@webhook_view('ClientName', notify_bot_owner_on_invalid_json=True)
|
||||||
def my_webhook_notify(request: HttpRequest, user_profile: UserProfile) -> None:
|
def my_webhook_notify(request: HttpRequest, user_profile: UserProfile) -> None:
|
||||||
raise InvalidJSONError("Malformed JSON")
|
raise InvalidJSONError("Malformed JSON")
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -12,7 +12,7 @@ from zerver.models import UserProfile
|
||||||
AIRBRAKE_TOPIC_TEMPLATE = '{project_name}'
|
AIRBRAKE_TOPIC_TEMPLATE = '{project_name}'
|
||||||
AIRBRAKE_MESSAGE_TEMPLATE = '[{error_class}]({error_url}): "{error_message}" occurred.'
|
AIRBRAKE_MESSAGE_TEMPLATE = '[{error_class}]({error_url}): "{error_message}" occurred.'
|
||||||
|
|
||||||
@api_key_only_webhook_view('Airbrake')
|
@webhook_view('Airbrake')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_airbrake_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_airbrake_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -3,14 +3,14 @@ from typing import Any, Dict, List
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('AlertManager')
|
@webhook_view('AlertManager')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_alertmanager_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_alertmanager_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any] = REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any] = REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict, List
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import REQ, api_key_only_webhook_view, has_request_variables
|
from zerver.decorator import REQ, has_request_variables, webhook_view
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
@ -18,7 +18,7 @@ ANSIBLETOWER_JOB_MESSAGE_TEMPLATE = """
|
||||||
|
|
||||||
ANSIBLETOWER_JOB_HOST_ROW_TEMPLATE = '* {hostname}: {status}\n'
|
ANSIBLETOWER_JOB_HOST_ROW_TEMPLATE = '* {hostname}: {status}\n'
|
||||||
|
|
||||||
@api_key_only_webhook_view('Ansibletower')
|
@webhook_view('Ansibletower')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_ansibletower_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_ansibletower_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -4,14 +4,14 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view("AppFollow")
|
@webhook_view("AppFollow")
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_appfollow_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_appfollow_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type="body")) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type="body")) -> HttpResponse:
|
||||||
|
|
|
@ -2,7 +2,7 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import REQ, api_key_only_webhook_view, has_request_variables
|
from zerver.decorator import REQ, has_request_variables, webhook_view
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
@ -15,7 +15,7 @@ APPVEYOR_MESSAGE_TEMPLATE = """
|
||||||
* **Finished**: {finished}
|
* **Finished**: {finished}
|
||||||
""".strip()
|
""".strip()
|
||||||
|
|
||||||
@api_key_only_webhook_view('Appveyor')
|
@webhook_view('Appveyor')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_appveyor_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_appveyor_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -4,7 +4,7 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -23,7 +23,7 @@ MESSAGE_TEMPLATE = "{user_name} {verb} the message [{title}]({url})"
|
||||||
TODO_LIST_TEMPLATE = "{user_name} {verb} the todo list [{title}]({url})"
|
TODO_LIST_TEMPLATE = "{user_name} {verb} the todo list [{title}]({url})"
|
||||||
TODO_TEMPLATE = "{user_name} {verb} the todo task [{title}]({url})"
|
TODO_TEMPLATE = "{user_name} {verb} the todo task [{title}]({url})"
|
||||||
|
|
||||||
@api_key_only_webhook_view('Basecamp')
|
@webhook_view('Basecamp')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_basecamp_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_basecamp_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -4,7 +4,7 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -19,7 +19,7 @@ def get_time(payload: Dict[str, Any]) -> Any:
|
||||||
time_remaining = (losedate - time.time())/3600
|
time_remaining = (losedate - time.time())/3600
|
||||||
return time_remaining
|
return time_remaining
|
||||||
|
|
||||||
@api_key_only_webhook_view("beeminder")
|
@webhook_view("beeminder")
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_beeminder_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_beeminder_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -7,7 +7,7 @@ from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -50,7 +50,7 @@ PULL_REQUEST_SUPPORTED_ACTIONS = [
|
||||||
'comment_deleted',
|
'comment_deleted',
|
||||||
]
|
]
|
||||||
|
|
||||||
@api_key_only_webhook_view('Bitbucket2')
|
@webhook_view('Bitbucket2')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_bitbucket2_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_bitbucket2_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body'),
|
payload: Dict[str, Any]=REQ(argument_type='body'),
|
||||||
|
|
|
@ -5,7 +5,7 @@ from typing import Any, Callable, Dict, List, Optional
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -354,7 +354,7 @@ def get_event_handler(eventkey: str) -> Callable[..., List[Dict[str, str]]]:
|
||||||
raise UnsupportedWebhookEventType("BitBucket Server", eventkey)
|
raise UnsupportedWebhookEventType("BitBucket Server", eventkey)
|
||||||
return handler
|
return handler
|
||||||
|
|
||||||
@api_key_only_webhook_view("Bitbucket3")
|
@webhook_view("Bitbucket3")
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_bitbucket3_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_bitbucket3_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type="body"),
|
payload: Dict[str, Any]=REQ(argument_type="body"),
|
||||||
|
|
|
@ -2,14 +2,14 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('Buildbot')
|
@webhook_view('Buildbot')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_buildbot_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_buildbot_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -3,14 +3,14 @@ from typing import Any, Dict, Optional
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('Canarytoken')
|
@webhook_view('Canarytoken')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_canarytoken_webhook(
|
def api_canarytoken_webhook(
|
||||||
request: HttpRequest, user_profile: UserProfile,
|
request: HttpRequest, user_profile: UserProfile,
|
||||||
|
|
|
@ -2,7 +2,7 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -14,7 +14,7 @@ outcome_to_formatted_status_map = {
|
||||||
"canceled": "was canceled",
|
"canceled": "was canceled",
|
||||||
}
|
}
|
||||||
|
|
||||||
@api_key_only_webhook_view('CircleCI')
|
@webhook_view('CircleCI')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_circleci_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_circleci_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type="body")) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type="body")) -> HttpResponse:
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict, Optional
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -513,7 +513,7 @@ IGNORED_EVENTS = {
|
||||||
'story-comment_update',
|
'story-comment_update',
|
||||||
}
|
}
|
||||||
|
|
||||||
@api_key_only_webhook_view('ClubHouse')
|
@webhook_view('ClubHouse')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_clubhouse_webhook(
|
def api_clubhouse_webhook(
|
||||||
request: HttpRequest, user_profile: UserProfile,
|
request: HttpRequest, user_profile: UserProfile,
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -20,7 +20,7 @@ CODESHIP_STATUS_MAPPER = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('Codeship')
|
@webhook_view('Codeship')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_codeship_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_codeship_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -18,7 +18,7 @@ CRASHLYTICS_SETUP_MESSAGE_TEMPLATE = "Webhook has been successfully configured."
|
||||||
VERIFICATION_EVENT = 'verification'
|
VERIFICATION_EVENT = 'verification'
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('Crashlytics')
|
@webhook_view('Crashlytics')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_crashlytics_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_crashlytics_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -2,7 +2,7 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -30,7 +30,7 @@ def body_template(score: int) -> str:
|
||||||
else:
|
else:
|
||||||
return FEEDBACK
|
return FEEDBACK
|
||||||
|
|
||||||
@api_key_only_webhook_view("Delighted")
|
@webhook_view("Delighted")
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_delighted_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_delighted_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Dict[str, Any]]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Dict[str, Any]]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -3,14 +3,14 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.actions import check_send_private_message
|
from zerver.lib.actions import check_send_private_message
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.models import UserProfile, get_user_profile_by_email
|
from zerver.models import UserProfile, get_user_profile_by_email
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view("dialogflow")
|
@webhook_view("dialogflow")
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_dialogflow_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_dialogflow_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body'),
|
payload: Dict[str, Any]=REQ(argument_type='body'),
|
||||||
|
|
|
@ -2,14 +2,14 @@ from typing import Optional
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view, has_request_variables
|
from zerver.decorator import has_request_variables, webhook_view
|
||||||
from zerver.lib.request import REQ, RequestVariableMissingError
|
from zerver.lib.request import REQ, RequestVariableMissingError
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('Dropbox', notify_bot_owner_on_invalid_json=False)
|
@webhook_view('Dropbox', notify_bot_owner_on_invalid_json=False)
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_dropbox_webhook(
|
def api_dropbox_webhook(
|
||||||
request: HttpRequest,
|
request: HttpRequest,
|
||||||
|
|
|
@ -2,7 +2,7 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -11,7 +11,7 @@ from zerver.models import UserProfile
|
||||||
ERRBIT_TOPIC_TEMPLATE = '{project_name}'
|
ERRBIT_TOPIC_TEMPLATE = '{project_name}'
|
||||||
ERRBIT_MESSAGE_TEMPLATE = '[{error_class}]({error_url}): "{error_message}" occurred.'
|
ERRBIT_MESSAGE_TEMPLATE = '[{error_class}]({error_url}): "{error_message}" occurred.'
|
||||||
|
|
||||||
@api_key_only_webhook_view('Errbit')
|
@webhook_view('Errbit')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_errbit_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_errbit_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -3,14 +3,14 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import REQ, api_key_only_webhook_view, has_request_variables
|
from zerver.decorator import REQ, has_request_variables, webhook_view
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
CHECK_IS_REPLY = "in reply to"
|
CHECK_IS_REPLY = "in reply to"
|
||||||
|
|
||||||
@api_key_only_webhook_view('Flock')
|
@webhook_view('Flock')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_flock_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_flock_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict, Tuple
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_error, json_success
|
from zerver.lib.response import json_error, json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -110,7 +110,7 @@ EVENT_FUNCTION_MAPPER = {
|
||||||
def get_body_based_on_event(event: str) -> Any:
|
def get_body_based_on_event(event: str) -> Any:
|
||||||
return EVENT_FUNCTION_MAPPER[event]
|
return EVENT_FUNCTION_MAPPER[event]
|
||||||
|
|
||||||
@api_key_only_webhook_view('Front')
|
@webhook_view('Front')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_front_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_front_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -2,7 +2,7 @@ from typing import Any, Dict, Optional
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -100,7 +100,7 @@ def get_outoftime_event_body(payload: Dict[str, Any]) -> str:
|
||||||
task_url=build_instance_url(payload['task_instance']),
|
task_url=build_instance_url(payload['task_instance']),
|
||||||
)
|
)
|
||||||
|
|
||||||
@api_key_only_webhook_view("Google-Code-In")
|
@webhook_view("Google-Code-In")
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_gci_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_gci_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict, Optional
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.webhooks.common import get_http_headers_from_filename
|
from zerver.lib.webhooks.common import get_http_headers_from_filename
|
||||||
from zerver.lib.webhooks.git import get_pull_request_event_message
|
from zerver.lib.webhooks.git import get_pull_request_event_message
|
||||||
|
@ -34,7 +34,7 @@ def format_pull_request_event(payload: Dict[str, Any],
|
||||||
|
|
||||||
return get_pull_request_event_message(**data)
|
return get_pull_request_event_message(**data)
|
||||||
|
|
||||||
@api_key_only_webhook_view('Gitea')
|
@webhook_view('Gitea')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_gitea_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_gitea_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body'),
|
payload: Dict[str, Any]=REQ(argument_type='body'),
|
||||||
|
|
|
@ -4,7 +4,7 @@ from typing import Any, Callable, Dict, Optional
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view, log_exception_to_webhook_logger
|
from zerver.decorator import log_exception_to_webhook_logger, webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -605,7 +605,7 @@ IGNORED_TEAM_ACTIONS = [
|
||||||
"removed_from_repository",
|
"removed_from_repository",
|
||||||
]
|
]
|
||||||
|
|
||||||
@api_key_only_webhook_view('GitHub', notify_bot_owner_on_invalid_json=True)
|
@webhook_view('GitHub', notify_bot_owner_on_invalid_json=True)
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_github_webhook(
|
def api_github_webhook(
|
||||||
request: HttpRequest, user_profile: UserProfile,
|
request: HttpRequest, user_profile: UserProfile,
|
||||||
|
|
|
@ -5,7 +5,7 @@ from typing import Any, Dict, Optional
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -353,7 +353,7 @@ EVENT_FUNCTION_MAPPER = {
|
||||||
'Pipeline Hook': get_pipeline_event_body,
|
'Pipeline Hook': get_pipeline_event_body,
|
||||||
}
|
}
|
||||||
|
|
||||||
@api_key_only_webhook_view("Gitlab")
|
@webhook_view("Gitlab")
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_gitlab_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_gitlab_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body'),
|
payload: Dict[str, Any]=REQ(argument_type='body'),
|
||||||
|
|
|
@ -5,7 +5,7 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -18,7 +18,7 @@ MESSAGE_TEMPLATE = (
|
||||||
'Comment: {}'
|
'Comment: {}'
|
||||||
)
|
)
|
||||||
|
|
||||||
@api_key_only_webhook_view('Gocd')
|
@webhook_view('Gocd')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_gocd_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_gocd_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body'),
|
payload: Dict[str, Any]=REQ(argument_type='body'),
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Callable, Dict, Optional
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -120,7 +120,7 @@ def format_release_event(payload: Dict[str, Any], include_title: bool=False) ->
|
||||||
|
|
||||||
return get_release_event_message(**data)
|
return get_release_event_message(**data)
|
||||||
|
|
||||||
@api_key_only_webhook_view('Gogs')
|
@webhook_view('Gogs')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_gogs_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_gogs_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body'),
|
payload: Dict[str, Any]=REQ(argument_type='body'),
|
||||||
|
|
|
@ -2,7 +2,7 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -19,7 +19,7 @@ The {status} **{name}** messaged:
|
||||||
""".strip()
|
""".strip()
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('GoSquared')
|
@webhook_view('GoSquared')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_gosquared_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_gosquared_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Dict[str, Any]]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Dict[str, Any]]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -2,7 +2,7 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -12,7 +12,7 @@ GRAFANA_TOPIC_TEMPLATE = '{alert_title}'
|
||||||
|
|
||||||
GRAFANA_MESSAGE_TEMPLATE = '[{rule_name}]({rule_url})\n\n{alert_message}{eval_matches}'
|
GRAFANA_MESSAGE_TEMPLATE = '[{rule_name}]({rule_url})\n\n{alert_message}{eval_matches}'
|
||||||
|
|
||||||
@api_key_only_webhook_view('Grafana')
|
@webhook_view('Grafana')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_grafana_webhook(
|
def api_grafana_webhook(
|
||||||
request: HttpRequest, user_profile: UserProfile,
|
request: HttpRequest, user_profile: UserProfile,
|
||||||
|
|
|
@ -2,7 +2,7 @@ from typing import Any, Dict, List
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -29,7 +29,7 @@ def dict_list_to_string(some_list: List[Any]) -> str:
|
||||||
internal_template = internal_template[:-2]
|
internal_template = internal_template[:-2]
|
||||||
return internal_template
|
return internal_template
|
||||||
|
|
||||||
@api_key_only_webhook_view('Greenhouse')
|
@webhook_view('Greenhouse')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_greenhouse_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_greenhouse_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -4,7 +4,7 @@ from typing import Any, Callable, Dict, Optional
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -82,7 +82,7 @@ def get_event_handler(event: str) -> Callable[..., str]:
|
||||||
raise UnsupportedWebhookEventType("Groove", event)
|
raise UnsupportedWebhookEventType("Groove", event)
|
||||||
return handler
|
return handler
|
||||||
|
|
||||||
@api_key_only_webhook_view('Groove')
|
@webhook_view('Groove')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_groove_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_groove_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -4,7 +4,7 @@ from typing import Any, Dict, Optional
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -84,7 +84,7 @@ EVENT_FUNCTION_MAPPER = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view("Harbor")
|
@webhook_view("Harbor")
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_harbor_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_harbor_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any] = REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any] = REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict, List
|
||||||
import orjson
|
import orjson
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -52,7 +52,7 @@ def get_recipients_text(recipients: List[str]) -> str:
|
||||||
|
|
||||||
return recipients_text
|
return recipients_text
|
||||||
|
|
||||||
@api_key_only_webhook_view('HelloSign')
|
@webhook_view('HelloSign')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_hellosign_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_hellosign_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Dict[str, Any]]=REQ(
|
payload: Dict[str, Dict[str, Any]]=REQ(
|
||||||
|
|
|
@ -3,14 +3,14 @@ from typing import Any, Dict, Iterable
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('HelloWorld')
|
@webhook_view('HelloWorld')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_helloworld_webhook(
|
def api_helloworld_webhook(
|
||||||
request: HttpRequest, user_profile: UserProfile,
|
request: HttpRequest, user_profile: UserProfile,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Webhooks for external integrations.
|
# Webhooks for external integrations.
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -15,7 +15,7 @@ TEMPLATE = """
|
||||||
```
|
```
|
||||||
""".strip()
|
""".strip()
|
||||||
|
|
||||||
@api_key_only_webhook_view("Heroku", notify_bot_owner_on_invalid_json=False)
|
@webhook_view("Heroku", notify_bot_owner_on_invalid_json=False)
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_heroku_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_heroku_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
head: str=REQ(), app: str=REQ(), user: str=REQ(),
|
head: str=REQ(), app: str=REQ(), user: str=REQ(),
|
||||||
|
|
|
@ -2,14 +2,14 @@ from typing import Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('HomeAssistant')
|
@webhook_view('HomeAssistant')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_homeassistant_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_homeassistant_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, str]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, str]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -3,14 +3,14 @@ from typing import Any, Dict
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_error, json_success
|
from zerver.lib.response import json_error, json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('IFTTT')
|
@webhook_view('IFTTT')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_iftt_app_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_iftt_app_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import REQ, api_key_only_webhook_view, has_request_variables
|
from zerver.decorator import REQ, has_request_variables, webhook_view
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
@ -15,7 +15,7 @@ State changed to **{state}**:
|
||||||
* **Timestamp**: {timestamp}
|
* **Timestamp**: {timestamp}
|
||||||
""".strip()
|
""".strip()
|
||||||
|
|
||||||
@api_key_only_webhook_view('Insping')
|
@webhook_view('Insping')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_insping_webhook(
|
def api_insping_webhook(
|
||||||
request: HttpRequest, user_profile: UserProfile,
|
request: HttpRequest, user_profile: UserProfile,
|
||||||
|
|
|
@ -4,7 +4,7 @@ from typing import Any, Callable, Dict, List, Tuple
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -282,7 +282,7 @@ def get_event_handler(event_type: str) -> Callable[..., Tuple[str, str]]:
|
||||||
raise UnsupportedWebhookEventType("Intercom", event_type)
|
raise UnsupportedWebhookEventType("Intercom", event_type)
|
||||||
return handler
|
return handler
|
||||||
|
|
||||||
@api_key_only_webhook_view('Intercom')
|
@webhook_view('Intercom')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_intercom_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_intercom_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -6,7 +6,7 @@ from typing import Any, Callable, Dict, List, Optional
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -316,7 +316,7 @@ def get_event_handler(event: Optional[str]) -> Optional[Callable[..., str]]:
|
||||||
|
|
||||||
return JIRA_CONTENT_FUNCTION_MAPPER.get(event)
|
return JIRA_CONTENT_FUNCTION_MAPPER.get(event)
|
||||||
|
|
||||||
@api_key_only_webhook_view("JIRA")
|
@webhook_view("JIRA")
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_jira_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_jira_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -5,7 +5,7 @@ import orjson
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_error, json_success
|
from zerver.lib.response import json_error, json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -140,7 +140,7 @@ class LibratoWebhookHandler(LibratoWebhookParser):
|
||||||
content += f", recorded at {recorded_at} UTC."
|
content += f", recorded at {recorded_at} UTC."
|
||||||
return content
|
return content
|
||||||
|
|
||||||
@api_key_only_webhook_view('Librato')
|
@webhook_view('Librato')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_librato_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_librato_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(converter=orjson.loads, default={})) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(converter=orjson.loads, default={})) -> HttpResponse:
|
||||||
|
|
|
@ -3,14 +3,14 @@ from typing import Any, Dict, Iterable
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('Mention')
|
@webhook_view('Mention')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_mention_webhook(
|
def api_mention_webhook(
|
||||||
request: HttpRequest, user_profile: UserProfile,
|
request: HttpRequest, user_profile: UserProfile,
|
||||||
|
|
|
@ -2,7 +2,7 @@ from typing import Any, Dict, Iterable
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -17,7 +17,7 @@ EVENTS = ['deploy_failed', 'deploy_locked', 'deploy_unlocked', 'deploy_building'
|
||||||
|
|
||||||
fixture_to_headers = get_http_headers_from_filename("HTTP_X_NETLIFY_EVENT")
|
fixture_to_headers = get_http_headers_from_filename("HTTP_X_NETLIFY_EVENT")
|
||||||
|
|
||||||
@api_key_only_webhook_view('Netlify')
|
@webhook_view('Netlify')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_netlify_webhook(
|
def api_netlify_webhook(
|
||||||
request: HttpRequest, user_profile: UserProfile,
|
request: HttpRequest, user_profile: UserProfile,
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict, Optional
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -27,7 +27,7 @@ Changelog:
|
||||||
```
|
```
|
||||||
""".strip()
|
""".strip()
|
||||||
|
|
||||||
@api_key_only_webhook_view("NewRelic")
|
@webhook_view("NewRelic")
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_newrelic_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_newrelic_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
alert: Optional[Dict[str, Any]]=REQ(validator=check_dict([]), default=None),
|
alert: Optional[Dict[str, Any]]=REQ(validator=check_dict([]), default=None),
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict, List
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -97,7 +97,7 @@ def format_object(
|
||||||
return message
|
return message
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view("Opbeat")
|
@webhook_view("Opbeat")
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_opbeat_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_opbeat_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -2,14 +2,14 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('OpsGenie')
|
@webhook_view('OpsGenie')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_opsgenie_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_opsgenie_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict, Iterable
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -157,7 +157,7 @@ def send_formated_pagerduty(request: HttpRequest,
|
||||||
body = template.format(**format_dict)
|
body = template.format(**format_dict)
|
||||||
check_send_webhook_message(request, user_profile, subject, body)
|
check_send_webhook_message(request, user_profile, subject, body)
|
||||||
|
|
||||||
@api_key_only_webhook_view('PagerDuty')
|
@webhook_view('PagerDuty')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_pagerduty_webhook(
|
def api_pagerduty_webhook(
|
||||||
request: HttpRequest, user_profile: UserProfile,
|
request: HttpRequest, user_profile: UserProfile,
|
||||||
|
|
|
@ -2,7 +2,7 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.validator import check_dict, check_list, check_string
|
from zerver.lib.validator import check_dict, check_list, check_string
|
||||||
|
@ -17,7 +17,7 @@ SEARCH_TEMPLATE = """
|
||||||
```
|
```
|
||||||
""".strip()
|
""".strip()
|
||||||
|
|
||||||
@api_key_only_webhook_view('Papertrail')
|
@webhook_view('Papertrail')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_papertrail_webhook(
|
def api_papertrail_webhook(
|
||||||
request: HttpRequest,
|
request: HttpRequest,
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -37,7 +37,7 @@ SUPPORTED_CHECK_TYPES = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('Pingdom')
|
@webhook_view('Pingdom')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_pingdom_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_pingdom_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -7,7 +7,7 @@ from defusedxml.ElementTree import fromstring as xml_fromstring
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import has_request_variables
|
from zerver.lib.request import has_request_variables
|
||||||
from zerver.lib.response import json_error, json_success
|
from zerver.lib.response import json_error, json_success
|
||||||
|
@ -156,7 +156,7 @@ def api_pivotal_webhook_v5(request: HttpRequest, user_profile: UserProfile) -> T
|
||||||
|
|
||||||
return subject, content
|
return subject, content
|
||||||
|
|
||||||
@api_key_only_webhook_view("Pivotal")
|
@webhook_view("Pivotal")
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_pivotal_webhook(request: HttpRequest, user_profile: UserProfile) -> HttpResponse:
|
def api_pivotal_webhook(request: HttpRequest, user_profile: UserProfile) -> HttpResponse:
|
||||||
subject = content = None
|
subject = content = None
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -11,7 +11,7 @@ from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('Raygun')
|
@webhook_view('Raygun')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_raygun_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_raygun_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any] = REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any] = REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -2,7 +2,7 @@ from typing import Any, Dict, Iterable
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -164,7 +164,7 @@ RB_MESSAGE_FUNCTIONS = {
|
||||||
'reply_published': get_reply_published_body,
|
'reply_published': get_reply_published_body,
|
||||||
}
|
}
|
||||||
|
|
||||||
@api_key_only_webhook_view('ReviewBoard')
|
@webhook_view('ReviewBoard')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_reviewboard_webhook(
|
def api_reviewboard_webhook(
|
||||||
request: HttpRequest, user_profile: UserProfile,
|
request: HttpRequest, user_profile: UserProfile,
|
||||||
|
|
|
@ -4,7 +4,7 @@ from urllib.parse import urlparse
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -87,7 +87,7 @@ GITHUB_URL_TEMPLATES = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('Semaphore')
|
@webhook_view('Semaphore')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_semaphore_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_semaphore_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict, List, Optional, Tuple
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -220,7 +220,7 @@ def handle_deprecated_payload(payload: Dict[str, Any]) -> Tuple[str, str]:
|
||||||
return (subject, body)
|
return (subject, body)
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('Sentry')
|
@webhook_view('Sentry')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_sentry_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_sentry_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any] = REQ(argument_type="body")) -> HttpResponse:
|
payload: Dict[str, Any] = REQ(argument_type="body")) -> HttpResponse:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.actions import check_send_stream_message
|
from zerver.lib.actions import check_send_stream_message
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_error, json_success
|
from zerver.lib.response import json_error, json_success
|
||||||
|
@ -10,7 +10,7 @@ from zerver.models import UserProfile
|
||||||
ZULIP_MESSAGE_TEMPLATE = "**{message_sender}**: `{text}`"
|
ZULIP_MESSAGE_TEMPLATE = "**{message_sender}**: `{text}`"
|
||||||
VALID_OPTIONS = {'SHOULD_NOT_BE_MAPPED': '0', 'SHOULD_BE_MAPPED': '1'}
|
VALID_OPTIONS = {'SHOULD_NOT_BE_MAPPED': '0', 'SHOULD_BE_MAPPED': '1'}
|
||||||
|
|
||||||
@api_key_only_webhook_view('Slack', notify_bot_owner_on_invalid_json=False)
|
@webhook_view('Slack', notify_bot_owner_on_invalid_json=False)
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_slack_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_slack_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
user_name: str=REQ(),
|
user_name: str=REQ(),
|
||||||
|
|
|
@ -6,7 +6,7 @@ import orjson
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import InvalidJSONError
|
from zerver.lib.exceptions import InvalidJSONError
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -14,7 +14,7 @@ from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('SlackIncoming')
|
@webhook_view('SlackIncoming')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_slack_incoming_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_slack_incoming_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
user_specified_topic: Optional[str]=REQ("topic", default=None),
|
user_specified_topic: Optional[str]=REQ("topic", default=None),
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -16,7 +16,7 @@ Build update (see [build log]({build_log_url})):
|
||||||
* **Status**: {status} {emoji}
|
* **Status**: {status} {emoji}
|
||||||
""".strip()
|
""".strip()
|
||||||
|
|
||||||
@api_key_only_webhook_view('SolanoLabs')
|
@webhook_view('SolanoLabs')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_solano_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_solano_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -17,7 +17,7 @@ Splunk alert from saved search:
|
||||||
* **Raw**: `{raw}`
|
* **Raw**: `{raw}`
|
||||||
""".strip()
|
""".strip()
|
||||||
|
|
||||||
@api_key_only_webhook_view('Splunk')
|
@webhook_view('Splunk')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_splunk_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_splunk_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import REQ, api_key_only_webhook_view, has_request_variables
|
from zerver.decorator import REQ, has_request_variables, webhook_view
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
@ -44,7 +44,7 @@ def get_component_topic(payload: Dict[str, Any]) -> str:
|
||||||
description = payload["page"]["status_description"],
|
description = payload["page"]["status_description"],
|
||||||
)
|
)
|
||||||
|
|
||||||
@api_key_only_webhook_view('Statuspage')
|
@webhook_view('Statuspage')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_statuspage_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_statuspage_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Sequence, Tuple
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -19,7 +19,7 @@ class SuppressedEvent(Exception):
|
||||||
class NotImplementedEventType(SuppressedEvent):
|
class NotImplementedEventType(SuppressedEvent):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@api_key_only_webhook_view('Stripe')
|
@webhook_view('Stripe')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_stripe_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_stripe_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body'),
|
payload: Dict[str, Any]=REQ(argument_type='body'),
|
||||||
|
|
|
@ -10,14 +10,14 @@ from typing import Any, Dict, List, Mapping, Optional, Tuple
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('Taiga')
|
@webhook_view('Taiga')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_taiga_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_taiga_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
message: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
message: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -5,7 +5,7 @@ from typing import Any, Dict, List, Optional
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.actions import (
|
from zerver.lib.actions import (
|
||||||
check_send_private_message,
|
check_send_private_message,
|
||||||
send_rate_limited_pm_notification_to_bot_owner,
|
send_rate_limited_pm_notification_to_bot_owner,
|
||||||
|
@ -45,7 +45,7 @@ def get_teamcity_property_value(property_list: List[Dict[str, str]], name: str)
|
||||||
return property['value']
|
return property['value']
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@api_key_only_webhook_view('Teamcity')
|
@webhook_view('Teamcity')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_teamcity_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_teamcity_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict, Optional, Tuple
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -105,7 +105,7 @@ def body(message: Dict[str, Any]) -> str:
|
||||||
return body
|
return body
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('Thinkst')
|
@webhook_view('Thinkst')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_thinkst_webhook(
|
def api_thinkst_webhook(
|
||||||
request: HttpRequest, user_profile: UserProfile,
|
request: HttpRequest, user_profile: UserProfile,
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Optional
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -12,7 +12,7 @@ from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('Transifex', notify_bot_owner_on_invalid_json=False)
|
@webhook_view('Transifex', notify_bot_owner_on_invalid_json=False)
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_transifex_webhook(
|
def api_transifex_webhook(
|
||||||
request: HttpRequest,
|
request: HttpRequest,
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Dict
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.lib.validator import check_bool, check_dict, check_string
|
from zerver.lib.validator import check_bool, check_dict, check_string
|
||||||
|
@ -20,7 +20,7 @@ MESSAGE_TEMPLATE = (
|
||||||
'Details: [changes]({}), [build log]({})'
|
'Details: [changes]({}), [build log]({})'
|
||||||
)
|
)
|
||||||
|
|
||||||
@api_key_only_webhook_view('Travis')
|
@webhook_view('Travis')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_travis_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_travis_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
ignore_pull_requests: bool = REQ(validator=check_bool, default=True),
|
ignore_pull_requests: bool = REQ(validator=check_bool, default=True),
|
||||||
|
|
|
@ -4,7 +4,7 @@ from typing import Any, Mapping, Optional, Tuple
|
||||||
import orjson
|
import orjson
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view, return_success_on_head_request
|
from zerver.decorator import return_success_on_head_request, webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -15,7 +15,7 @@ from .board_actions import SUPPORTED_BOARD_ACTIONS, process_board_action
|
||||||
from .card_actions import IGNORED_CARD_ACTIONS, SUPPORTED_CARD_ACTIONS, process_card_action
|
from .card_actions import IGNORED_CARD_ACTIONS, SUPPORTED_CARD_ACTIONS, process_card_action
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('Trello')
|
@webhook_view('Trello')
|
||||||
@return_success_on_head_request
|
@return_success_on_head_request
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_trello_webhook(request: HttpRequest,
|
def api_trello_webhook(request: HttpRequest,
|
||||||
|
|
|
@ -4,7 +4,7 @@ from typing import Any, Dict, List
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
from zerver.lib.exceptions import UnsupportedWebhookEventType
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
|
@ -54,7 +54,7 @@ def get_body_for_down_event(event: Dict[str, Any]) -> str:
|
||||||
event['downtime']['error'],
|
event['downtime']['error'],
|
||||||
event['downtime']['started_at'].replace('T', ' ').replace('Z', ' UTC'))
|
event['downtime']['started_at'].replace('T', ' ').replace('Z', ' UTC'))
|
||||||
|
|
||||||
@api_key_only_webhook_view('Updown')
|
@webhook_view('Updown')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_updown_webhook(
|
def api_updown_webhook(
|
||||||
request: HttpRequest, user_profile: UserProfile,
|
request: HttpRequest, user_profile: UserProfile,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_error, json_success
|
from zerver.lib.response import json_error, json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
|
@ -19,7 +19,7 @@ New blog user registered:
|
||||||
""".strip()
|
""".strip()
|
||||||
WP_LOGIN_TEMPLATE = 'User {name} logged in.'
|
WP_LOGIN_TEMPLATE = 'User {name} logged in.'
|
||||||
|
|
||||||
@api_key_only_webhook_view("Wordpress", notify_bot_owner_on_invalid_json=False)
|
@webhook_view("Wordpress", notify_bot_owner_on_invalid_json=False)
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_wordpress_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_wordpress_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
hook: str=REQ(default="WordPress Action"),
|
hook: str=REQ(default="WordPress Action"),
|
||||||
|
|
|
@ -3,14 +3,14 @@ from typing import Optional
|
||||||
|
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.actions import check_send_private_message
|
from zerver.lib.actions import check_send_private_message
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_success
|
from zerver.lib.response import json_success
|
||||||
from zerver.models import UserProfile, get_user
|
from zerver.models import UserProfile, get_user
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('Yo', notify_bot_owner_on_invalid_json=False)
|
@webhook_view('Yo', notify_bot_owner_on_invalid_json=False)
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_yo_app_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_yo_app_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
email: str = REQ(default=""),
|
email: str = REQ(default=""),
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Any, Dict
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from zerver.decorator import REQ, api_key_only_webhook_view, has_request_variables
|
from zerver.decorator import REQ, has_request_variables, webhook_view
|
||||||
from zerver.lib.actions import send_rate_limited_pm_notification_to_bot_owner
|
from zerver.lib.actions import send_rate_limited_pm_notification_to_bot_owner
|
||||||
from zerver.lib.response import json_error, json_success
|
from zerver.lib.response import json_error, json_success
|
||||||
from zerver.lib.send_email import FromAddress
|
from zerver.lib.send_email import FromAddress
|
||||||
|
@ -26,7 +26,7 @@ ZABBIX_MESSAGE_TEMPLATE = """
|
||||||
* {item}
|
* {item}
|
||||||
""".strip()
|
""".strip()
|
||||||
|
|
||||||
@api_key_only_webhook_view('Zabbix')
|
@webhook_view('Zabbix')
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_zabbix_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_zabbix_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
|
@ -3,14 +3,14 @@ from typing import Any, Dict
|
||||||
from django.http import HttpRequest, HttpResponse
|
from django.http import HttpRequest, HttpResponse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from zerver.decorator import api_key_only_webhook_view
|
from zerver.decorator import webhook_view
|
||||||
from zerver.lib.request import REQ, has_request_variables
|
from zerver.lib.request import REQ, has_request_variables
|
||||||
from zerver.lib.response import json_error, json_success
|
from zerver.lib.response import json_error, json_success
|
||||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
|
|
||||||
|
|
||||||
@api_key_only_webhook_view('Zapier', notify_bot_owner_on_invalid_json=False)
|
@webhook_view('Zapier', notify_bot_owner_on_invalid_json=False)
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def api_zapier_webhook(request: HttpRequest, user_profile: UserProfile,
|
def api_zapier_webhook(request: HttpRequest, user_profile: UserProfile,
|
||||||
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
payload: Dict[str, Any]=REQ(argument_type='body')) -> HttpResponse:
|
||||||
|
|
Loading…
Reference in New Issue