Mandrill Inbound的Python封装
项目描述
# Mandrill Inbound Python Wrapper [](https://travis-ci.org/jpadilla/mandrill-inbound-python)
这是一个简单的API封装,用于[Mandrill的入站邮件webhook](http://help.mandrill.com/entries/22092308-What-is-the-format-of-inbound-email-webhooks-)
在Python中受到我制作的这个Python封装库的启发,该库用于[Postmark Inbound](https://github.com/jpadilla/postmark-inbound-python)。
## 安装
使用Github
```
git clone git://github.com/jpadilla/mandrill-inbound-python.git
```
使用pip
```
pip安装python-mandrill-inbound
```
使用easy_install
```
easy_install python-mandrill-inbound
```
使用方法
-----
```python
from mandrill_inbound import MandrillInbound
# 从JSON字符串加载
json_data = open('./tests/fixtures/valid_http_post.json').read()
inbound = MandrillInbound(json=json_data)
# 从Python字典加载
json_data = json.loads(open('./tests/fixtures/valid_http_post.json').read())
inbound = MandrillInbound(source=json_data)
# 内容
print inbound.subject
print inbound.sender
print inbound.to
print inbound.cc
print inbound.recipients
print inbound.message_id
print inbound.mailbox_hash
print inbound.html_body
print inbound.text_body
print inbound.send_date
print inbound.ts
# 垃圾邮件和欺骗检测
print inbound.spf
print inbound.dkim
print inbound.spam_score
# 头部
print inbound.headers # 默认获取所有头部信息
print inbound.headers['MIME-Version']
print inbound.headers['Received-SPF']
# 附件
print inbound.has_attachments # 布尔值
attachments = inbound.attachments
first_attachment = attachments[0]
print first_attachment.name
second_attachment = attachments[1]
print second_attachment.content_length
for a in attachments
print a.name
print a.content_type
print a.read()
print a.download('./tests/', ['image/png'])
# 原始数据
print inbound.source
print inbound.msg
```
错误追踪器
-----------
有错误吗?请在此GitHub上创建一个问题!
贡献
-------------
* 分支
* 编写测试
* 编写代码
* 提交拉取请求
感谢您的帮助。
许可证
---------------------
MIT许可证
这是一个简单的API封装,用于[Mandrill的入站邮件webhook](http://help.mandrill.com/entries/22092308-What-is-the-format-of-inbound-email-webhooks-)
在Python中受到我制作的这个Python封装库的启发,该库用于[Postmark Inbound](https://github.com/jpadilla/postmark-inbound-python)。
## 安装
使用Github
```
git clone git://github.com/jpadilla/mandrill-inbound-python.git
```
使用pip
```
pip安装python-mandrill-inbound
```
使用easy_install
```
easy_install python-mandrill-inbound
```
使用方法
-----
```python
from mandrill_inbound import MandrillInbound
# 从JSON字符串加载
json_data = open('./tests/fixtures/valid_http_post.json').read()
inbound = MandrillInbound(json=json_data)
# 从Python字典加载
json_data = json.loads(open('./tests/fixtures/valid_http_post.json').read())
inbound = MandrillInbound(source=json_data)
# 内容
print inbound.subject
print inbound.sender
print inbound.to
print inbound.cc
print inbound.recipients
print inbound.message_id
print inbound.mailbox_hash
print inbound.html_body
print inbound.text_body
print inbound.send_date
print inbound.ts
# 垃圾邮件和欺骗检测
print inbound.spf
print inbound.dkim
print inbound.spam_score
# 头部
print inbound.headers # 默认获取所有头部信息
print inbound.headers['MIME-Version']
print inbound.headers['Received-SPF']
# 附件
print inbound.has_attachments # 布尔值
attachments = inbound.attachments
first_attachment = attachments[0]
print first_attachment.name
second_attachment = attachments[1]
print second_attachment.content_length
for a in attachments
print a.name
print a.content_type
print a.read()
print a.download('./tests/', ['image/png'])
# 原始数据
print inbound.source
print inbound.msg
```
错误追踪器
-----------
有错误吗?请在此GitHub上创建一个问题!
贡献
-------------
* 分支
* 编写测试
* 编写代码
* 提交拉取请求
感谢您的帮助。
许可证
---------------------
MIT许可证
项目详情
关闭
python-mandrill-inbound-0.0.4.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 50bb462d8004dd69a552b962fccfc3872db5bbb76ead92850db50b13c132914c |
|
MD5 | 3d898bf8376f7f3eb60ed663d216c91e |
|
BLAKE2b-256 | 2d9a6495636a5525757decee372e07b79a783cacfba72b4b2b2b1d66eef2576e |