邮戳DMARC监视API的Python CLI接口
py-postdmarc的Python项目详细描述
py postdmarc
A Python interface for the Postmark DMARC monitoring API.
目录
示例
setPOSTMARK_API_KEY="aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" postdmarc get_record postdmarc export_all_reports --from_date 2020-01-01 --to_date 2020-01-08 --filepath reports.json
安装
^{pr2}$克隆
使用https://github.com/scuriosity/py-postdmarc
将此repo克隆到本地计算机,然后使用pip在本地安装:
git clone https://github.com/scuriosity/py-postdmarc
pip install .
特点
实现API Documentation提供的10个API方法:
- 创建记录
- 记录下来
- 更新记录
- 获取DNS片段
- 验证DNS
- 删除记录
- 列出DMARC报告
- 按ID获取特定的DMARC报告
- 恢复API令牌
- 旋转API令牌
以及
- 将给定时间范围内的所有取证报告导出到JSON文件。在
使用
API密钥
对于大多数命令,您的邮戳API密钥是必需的。py postdmarc包可以从POSTMARK_API_KEY
环境变量或包根目录中的文件PM_API.key
加载API密钥。API密钥应该是这样的十六进制字符串:
aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
py-postdmarc/
+-- postdmarc/
| +-- __init__.py
| +-- pdm_exceptions.py
| â””-- postdmarc.py
|
+-- tests/
| +-- __init__.py
| +-- test_meta.py
| â””-- test_postdmarc.py
|
+-- license.txt
+-- PM_API.key
+-- readme.md
+-- requirements.txt
+-- setup.py
如果未在这两个位置之一设置密钥,则将引发ApikeMissingError。在
语法
创建记录
postdmarc create_record --email EMAIL@domain.com --domain domain.com
获取记录
postdmarc get_record
更新记录
postdmarc update_record --email EMAIL@domeng.com
获取DNS片段
postdmarc get_dns_snippet
验证DNS
postdmarc verify_dns
删除记录
postdmarc delete_record
List DMARC报告
postdmarc list_reports --from_date 01-01-2020 --to_date 01-02-2020
提供了“after”、“before”和“reverse”的可选标志。在
按ID获取特定的DMARC报告
postdmarc get_report --id 1234567
postdmarc get_report --id 1234567 --fmt xml
Recover API令牌
postdmarc recover_token --owner domain.com
Rotate API令牌
postdmarc rotate_token
导出所有法医报告
postdmarc export_all_reports --from_date 2020-01-01 --to_date 2020-01-08 --filepath reports.json
贡献
问题和拉请求是受欢迎的。使用https://github.com/scuriosity/py-postdmarc/compare创建新的请求
许可证
- MIT license
- 版权所有2020 Scuriosity。在
- 项目
标签: