钉钉群告警Handler
通过钉钉群机器人, 发送Python日志到钉钉群
参考钉钉群机器人接口 https://open.dingtalk.com/document/robots/custom-robot-access
安装
pip install dingtalk-log-handler
打包
python setup.py sdist
参数
- webhook: webhook url for dingtalk open api
- keyword: allowed message keyword, default 'alarm'
- secret: secret for dingtalk open api
- hostname: hostname for identify machine, default local ip address
- timeout: http request timeout, default 1 second
- cert_verify: verify SSL certificates or not, default True
使用示例
import logging
import logging.config
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '[%(levelname)s %(asctime)s %(name)s %(funcName)s %(lineno)d %(process)d]\t%(message)s'
},
},
'handlers': {
'dingtalk':{
'class': 'dingtalk_log_handler.DingTalkHandler',
'webhook': 'https://oapi.dingtalk.com/robot/send?access_token=XXXXX',
# 'secret': '',
# 'keyword': '',
'formatter':'verbose',
'level': 'ERROR',
},
'console': {
'level': 'INFO',
'class': 'logging.StreamHandler',
'formatter': 'verbose',
},
},
'loggers': {
'': {
'handlers': ['dingtalk', 'console'],
'level': 'INFO',
'propagate': False,
},
}
}
logging.config.dictConfig(LOGGING)
logging.error('testing')
Metadata
Release files for dingtalk-log-handler 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dingtalk-log-handler-0.0.7.tar.gz | 7.6 kB | Without provenance | Details for dingtalk-log-handler-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dingtalk_log_handler-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for dingtalk_log_handler-0.0.7-py3-none-any.whl |
Total release size: 15.4 kB
Release files / dingtalk-log-handler-0.0.7.tar.gz
| Download URL | dingtalk-log-handler-0.0.7.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
04aa31c53afe17d6941c845632367e5b5a0ef51c860e053033e7f50c428fd2d4
|
|
BLAKE2b-256 checksum How to use checksums |
2652f8df08a24e1a71c421b1753a6f1a607f8ab6a0da04acebe643f1f895f240
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6
|
Release files / dingtalk_log_handler-0.0.7-py3-none-any.whl
| Download URL | dingtalk_log_handler-0.0.7-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c832e22690ac2a0a40c25e6838983f9f86834e76a2a3471e40cb10f7c939e2d9
|
|
BLAKE2b-256 checksum How to use checksums |
ed15334955aff040330e5e74ae3d8fbc3f5fee9a5ea4072fb27576d2ee13efa7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6
|
Security for dingtalk-log-handler 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.