Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
py12306
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
python
py12306
Commits
d7c9a1cb
Commit
d7c9a1cb
authored
Jan 14, 2019
by
Echowxsy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
实现钉钉通知方法
parent
b78f1c6a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
notification.py
py12306/helpers/notification.py
+13
-0
No files found.
py12306/helpers/notification.py
View file @
d7c9a1cb
...
...
@@ -20,6 +20,11 @@ class Notification():
self
=
cls
()
self
.
send_voice_code_of_yiyuan
(
phone
,
name
=
name
,
content
=
content
)
@
classmethod
def
dingtalk_webhook
(
cls
,
content
=
''
):
self
=
cls
()
self
.
send_dingtalk_by_webbook
(
content
=
content
)
@
classmethod
def
send_email
(
cls
,
to
,
title
=
''
,
content
=
''
):
self
=
cls
()
...
...
@@ -77,9 +82,17 @@ class Notification():
except
Exception
as
e
:
CommonLog
.
add_quick_log
(
CommonLog
.
MESSAGE_SEND_EMAIL_FAIL
.
format
(
e
))
.
flush
()
def
send_dingtalk_by_webbook
(
self
,
content
):
from
dingtalkchatbot.chatbot
import
DingtalkChatbot
webhook
=
Config
()
.
DINGTALK_WEBHOOK
dingtalk
=
DingtalkChatbot
(
webhook
)
dingtalk
.
send_text
(
msg
=
content
,
is_at_all
=
True
)
pass
if
__name__
==
'__main__'
:
name
=
'张三4'
content
=
'你的车票 广州 到 深圳 购买成功,请登录 12306 进行支付'
# Notification.voice_code('13800138000', name, content)
Notification
.
send_email
(
'user@email.com'
,
name
,
content
)
Notification
.
dingtalk_webhook
(
content
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment