Skip to main content

发网消息通知组件

发送企业微信消息

from FineEx.Middleware.Message.pywechat import WorkChatSender
def weChat():
    corpid = 'corpid'
    corpsecret = 'corpsecret'
    agentid = '1000039'
    workSender = WorkChatSender(corpid=corpid, corpsecret=corpsecret, agentid=agentid)
    workSender.send_text("hello", touser='91237')
    subject = '测试异常'
    message = f"""
        >**测试信息异常** 
        请尽快处理!
        查看详情,请点击:[FineEx](https://www.fineex.net)
        """
    workSender.send_markdown(subject + "\n" + message.strip())
    workSender.send_image(r"iamge_path", touser='receiver')
    workSender.send_file(r"file_path", touser='receiver')
    workSender.send_video(r"video_path", touser='receiver')
    workSender.send_voice(r"voice_path", touser='receiver')

企业微信消息通知官方文档

发送网易邮件

from FineEx.Middleware.Message.pyemail import MailSender
def Mail():
    # 普通文本邮件
    sml1 = MailSender('sender', 'yourpassword', 'smtp.qiye.163.com:465')
    sml1.setMailInfo('receiver', '测试标题', '测试正文', 'plain')
    sml1.sendMail()

    # html文件带文件
    sml2 = MailSender('sender', 'yourpassword', 'smtp.qiye.163.com:465')
    content = sml2.generateHtml('告警', '测试告警标题', '张三', '测试告警内容')
    sml2.setMailInfo('receiver', '测试标题', content, 'html', r'file_path')
    sml2.sendMail()

发送pushdeer消息

from FineEx.Middleware.Message.pypushdeer import PushDeerSender
def pushDeer():
    pushdeer = PushDeerSender(pushkey="pushkey")
    pushdeer.send_text("hello world", desp="optional description")
    pushdeer.send_markdown("# hello world", desp="**optional** description in markdown")
    pushdeer.send_image("https://github.com/easychen/pushdeer/raw/main/doc/image/clipcode.png")
    pushdeer.send_image(
        "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=")

pushdeer项目地址

通过阿里云短信服务发送消息

from FineEx.Middleware.Message.pysms import SmsSender
def Sms():
    ACCESS_KEY_ID = ''
    ACCESS_KEY_SECRET = ''
    SIGN_NAME = ''
    template_code = ''
    PhoneNumber = ''
    msg = {
        "mgs": "服务器192.168.1.1异常,系统CPU过高,当前值100%",
        "outer": "test"
    }
    sms = SmsSender(ACCESS_KEY_ID, ACCESS_KEY_SECRET, SIGN_NAME, template_code)
    sms.sendSms(PhoneNumber, **msg)

阿里云短息服务地址

电话通知

from FineEx.Middleware.Message.pyphone import PhoneCaller
def Call():
    caller = PhoneCaller('account', 'password')
    msg = '机房温度异常:嘉合机房当前温度30度,请尽快安排人员排查情况'
    mobile = '17601234567'
    print(caller.call(msg, mobile))

互亿无线

Metadata

Release files for FineEx.Cloud.Middle.Message 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for FineEx.Cloud.Middle.Message 1.0.3
File Size Uploaded
FineEx.Cloud.Middle.Message-1.0.3.tar.gz 12.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for FineEx.Cloud.Middle.Message 1.0.3
File Interpreter ABI Platform
FineEx.Cloud.Middle.Message-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 27.7 kB

Release files / FineEx.Cloud.Middle.Message-1.0.3.tar.gz

Download URL FineEx.Cloud.Middle.Message-1.0.3.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f31da4076627c2bcb228f67d28dbf4d33cc29fa1091ce611a1b47b5b7957a8e8
BLAKE2b-256 checksum
How to use checksums
bf46b41b9136779f4b9a26456c7ac7d75d3c8d28ddb95e7a246aac3b4c6ab85a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.11

Release files / FineEx.Cloud.Middle.Message-1.0.3-py3-none-any.whl

Download URL FineEx.Cloud.Middle.Message-1.0.3-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b7ce58225c56bbb684579e9ecc22a1558d6bf9cef6931c062fc150382d7cc35
BLAKE2b-256 checksum
How to use checksums
3b36ee3bc62fc0f3d12c2bf841752a856b7fae4b2bb8b3e64e80c9dd9dc82e1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.11

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page