gsender


Namegsender JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://github.com/Leviathangk/gsender
Summary一个报警合集
upload_time2022-12-15 05:11:31
maintainer
docs_urlNone
author郭一会儿
requires_python
licenseMIT Licence
keywords email sender dingtalk
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # galarm

一个消息发送合集,有以下模块

- EmailSender:邮件发送
- DingTalkSender:钉钉群聊机器人

# EmailSender

有以下参数

- receiver:接收者(可以是列表)
- content_text:邮件内容
- content_html:邮件内容(html 形式)
- files:文件路径(可以是列表)

【示例】

```
sender = EmailSender(user='xxx', pwd='xxx')
sender.send(receiver='', content_text='这是一封测试邮件')
```

# DingTalkSender

支持钉钉所有消息类型消息发送  
了解链接:https://open.dingtalk.com/document/group/message-types-and-data-format#topic-2098229

【示例】

```
d = DingTalkSender(secret=DING_TALK_SECRET, access_token=DING_TALK_ACCESS_TOKEN)

d.send_text(content='测试消息', at_all=True)

d.send_text(content='测试消息', at_mobiles='xxx')

d.send_markdown(title='test', text='测试消息')

d.send_link(title='test', text='测试消息', message_url="https://www.baidu.com/")

d.send_feed_card(links=[
    {
        "title": "时代的火车向前开1",
        "messageURL": "https://www.dingtalk.com/",
        "picURL": "https://img.alicdn.com/tfs/TB1NwmBEL9TBuNjy1zbXXXpepXa-2400-1218.png"
    },
    {
        "title": "时代的火车向前开2",
        "messageURL": "https://www.dingtalk.com/",
        "picURL": "https://img.alicdn.com/tfs/TB1NwmBEL9TBuNjy1zbXXXpepXa-2400-1218.png"
    }
])

d.send_action_card_only(**{
    "title": "乔布斯 20 年前想打造一间苹果咖啡厅,而它正是 Apple Store 的前身",
    "text": "![screenshot](https://img.alicdn.com/tfs/TB1NwmBEL9TBuNjy1zbXXXpepXa-2400-1218.png) \n\n #### 乔布斯 20 年前想打造的苹果咖啡厅 \n\n Apple Store 的设计正从原来满满的科技感走向生活化,而其生活化的走向其实可以追溯到 20 年前苹果一个建立咖啡馆的计划",
    "btn_orientation": 0,
    "btns": [
        {
            "title": "内容不错",
            "actionURL": "https://www.dingtalk.com/"
        },
        {
            "title": "不感兴趣",
            "actionURL": "https://www.dingtalk.com/"
        }
    ]
})
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Leviathangk/gsender",
    "name": "gsender",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "email,sender,dingtalk",
    "author": "\u90ed\u4e00\u4f1a\u513f",
    "author_email": "1015295213@qq.com",
    "download_url": "https://files.pythonhosted.org/packages/04/22/43fe26d295c0f02b0943b9b3970e7c0b1f63f024a5fff3218e9fa1958f44/gsender-0.0.3.tar.gz",
    "platform": "any",
    "description": "# galarm\r\n\r\n\u4e00\u4e2a\u6d88\u606f\u53d1\u9001\u5408\u96c6\uff0c\u6709\u4ee5\u4e0b\u6a21\u5757\r\n\r\n- EmailSender\uff1a\u90ae\u4ef6\u53d1\u9001\r\n- DingTalkSender\uff1a\u9489\u9489\u7fa4\u804a\u673a\u5668\u4eba\r\n\r\n# EmailSender\r\n\r\n\u6709\u4ee5\u4e0b\u53c2\u6570\r\n\r\n- receiver\uff1a\u63a5\u6536\u8005\uff08\u53ef\u4ee5\u662f\u5217\u8868\uff09\r\n- content_text\uff1a\u90ae\u4ef6\u5185\u5bb9\r\n- content_html\uff1a\u90ae\u4ef6\u5185\u5bb9\uff08html \u5f62\u5f0f\uff09\r\n- files\uff1a\u6587\u4ef6\u8def\u5f84\uff08\u53ef\u4ee5\u662f\u5217\u8868\uff09\r\n\r\n\u3010\u793a\u4f8b\u3011\r\n\r\n```\r\nsender = EmailSender(user='xxx', pwd='xxx')\r\nsender.send(receiver='', content_text='\u8fd9\u662f\u4e00\u5c01\u6d4b\u8bd5\u90ae\u4ef6')\r\n```\r\n\r\n# DingTalkSender\r\n\r\n\u652f\u6301\u9489\u9489\u6240\u6709\u6d88\u606f\u7c7b\u578b\u6d88\u606f\u53d1\u9001  \r\n\u4e86\u89e3\u94fe\u63a5\uff1ahttps://open.dingtalk.com/document/group/message-types-and-data-format#topic-2098229\r\n\r\n\u3010\u793a\u4f8b\u3011\r\n\r\n```\r\nd = DingTalkSender(secret=DING_TALK_SECRET, access_token=DING_TALK_ACCESS_TOKEN)\r\n\r\nd.send_text(content='\u6d4b\u8bd5\u6d88\u606f', at_all=True)\r\n\r\nd.send_text(content='\u6d4b\u8bd5\u6d88\u606f', at_mobiles='xxx')\r\n\r\nd.send_markdown(title='test', text='\u6d4b\u8bd5\u6d88\u606f')\r\n\r\nd.send_link(title='test', text='\u6d4b\u8bd5\u6d88\u606f', message_url=\"https://www.baidu.com/\")\r\n\r\nd.send_feed_card(links=[\r\n    {\r\n        \"title\": \"\u65f6\u4ee3\u7684\u706b\u8f66\u5411\u524d\u5f001\",\r\n        \"messageURL\": \"https://www.dingtalk.com/\",\r\n        \"picURL\": \"https://img.alicdn.com/tfs/TB1NwmBEL9TBuNjy1zbXXXpepXa-2400-1218.png\"\r\n    },\r\n    {\r\n        \"title\": \"\u65f6\u4ee3\u7684\u706b\u8f66\u5411\u524d\u5f002\",\r\n        \"messageURL\": \"https://www.dingtalk.com/\",\r\n        \"picURL\": \"https://img.alicdn.com/tfs/TB1NwmBEL9TBuNjy1zbXXXpepXa-2400-1218.png\"\r\n    }\r\n])\r\n\r\nd.send_action_card_only(**{\r\n    \"title\": \"\u4e54\u5e03\u65af 20 \u5e74\u524d\u60f3\u6253\u9020\u4e00\u95f4\u82f9\u679c\u5496\u5561\u5385\uff0c\u800c\u5b83\u6b63\u662f Apple Store \u7684\u524d\u8eab\",\r\n    \"text\": \"![screenshot](https://img.alicdn.com/tfs/TB1NwmBEL9TBuNjy1zbXXXpepXa-2400-1218.png) \\n\\n #### \u4e54\u5e03\u65af 20 \u5e74\u524d\u60f3\u6253\u9020\u7684\u82f9\u679c\u5496\u5561\u5385 \\n\\n Apple Store \u7684\u8bbe\u8ba1\u6b63\u4ece\u539f\u6765\u6ee1\u6ee1\u7684\u79d1\u6280\u611f\u8d70\u5411\u751f\u6d3b\u5316\uff0c\u800c\u5176\u751f\u6d3b\u5316\u7684\u8d70\u5411\u5176\u5b9e\u53ef\u4ee5\u8ffd\u6eaf\u5230 20 \u5e74\u524d\u82f9\u679c\u4e00\u4e2a\u5efa\u7acb\u5496\u5561\u9986\u7684\u8ba1\u5212\",\r\n    \"btn_orientation\": 0,\r\n    \"btns\": [\r\n        {\r\n            \"title\": \"\u5185\u5bb9\u4e0d\u9519\",\r\n            \"actionURL\": \"https://www.dingtalk.com/\"\r\n        },\r\n        {\r\n            \"title\": \"\u4e0d\u611f\u5174\u8da3\",\r\n            \"actionURL\": \"https://www.dingtalk.com/\"\r\n        }\r\n    ]\r\n})\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT Licence",
    "summary": "\u4e00\u4e2a\u62a5\u8b66\u5408\u96c6",
    "version": "0.0.3",
    "split_keywords": [
        "email",
        "sender",
        "dingtalk"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "06555e388910190fef782c9438bce149",
                "sha256": "9248bf614b0c02165b11358fffc7b177d49a4d49989e460aea32f4f15b19be9a"
            },
            "downloads": -1,
            "filename": "gsender-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "06555e388910190fef782c9438bce149",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4811,
            "upload_time": "2022-12-15T05:11:31",
            "upload_time_iso_8601": "2022-12-15T05:11:31.820668Z",
            "url": "https://files.pythonhosted.org/packages/04/22/43fe26d295c0f02b0943b9b3970e7c0b1f63f024a5fff3218e9fa1958f44/gsender-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-15 05:11:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "Leviathangk",
    "github_project": "gsender",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "gsender"
}
        
Elapsed time: 0.03328s