Skip to content

Commit

Permalink
更新至0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
anshengme committed May 8, 2019
1 parent a3ddd36 commit a12e9e6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="sentry-dingding",
version='0.0.2',
version='0.0.3',
author='ansheng',
author_email='ianshengme@gmail.com',
url='https://github.com/anshengme/sentry-dingding',
Expand Down
2 changes: 1 addition & 1 deletion src/sentry_dingding/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# coding: utf-8

VERSION = "0.0.2"
VERSION = "0.0.3"
11 changes: 5 additions & 6 deletions src/sentry_dingding/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,19 @@ def is_configured(self, project):
"""
return bool(self.get_option('access_token', project))

def notify_users(self, group, event, fail_silently=False):
self.post_process(group, event, fail_silently=fail_silently)
def notify_users(self, group, event, *args, **kwargs):
self.post_process(group, event, *args, **kwargs)

def post_process(self, group, event, **kwargs):
def post_process(self, group, event, *args, **kwargs):
"""
Process error.
"""
if not self.is_configured(group.project):
return

access_token = self.get_option('access_token', group.project)

send_url = DingTalk_API.format(token=access_token)
title = "New alert from {}".format(event.project.name)
title = "New alert from {}".format(event.project.slug)

data = {
"msgtype": "markdown",
Expand All @@ -59,7 +58,7 @@ def post_process(self, group, event, **kwargs):
"text": u"#### {title} \n > {message} [href]({url})".format(
title=title,
message=event.message,
url=u"{0}events/{1}/".format(group.get_absolute_url(), event.id)
url=u"{}events/{}/".format(group.get_absolute_url(), event.id),
)
}
}
Expand Down

0 comments on commit a12e9e6

Please sign in to comment.