Python + Webhooks 简化制作
项目描述
Python + Webhooks 简化制作
免费软件:BSD许可
警告:该项目处于预alpha状态。它不适合用于任何东西。
Python版本
目前适用于
Python 2.7
Python 3.3
现有功能
易于集成到任何包或项目中
包含同步webhooks的几个内置发送器。
包含RedisQ驱动的异步webhook。
通过使用自定义发送器和哈希函数扩展功能。
计划中的功能
包含同步和异步webhooks的许多内置发送器。
针对将多个具有相同负载发送到同一目标的多个发送进行合并的特殊功能。
遵循 http://resthooks.org 模式
优秀的文档
PyPy兼容性
用法
按照以下简单步骤操作
导入 webhook 装饰器。
定义一个返回可序列化为JSON的字典或可迭代的函数。
添加 webhook 装饰器并传入一个 sender_callable。
调用函数!
同步示例(异步示例即将推出)
>>> from webhooks import webhook
>>> from webhooks.senders import targeted
>>> @webhook(sender_callable=targeted.sender)
>>> def basic(url, wife, husband):
>>> return {"husband": husband, "wife": wife}
>>> r = basic(url="http://httpbin.org/post", husband="Danny", wife="Audrey")
>>> import pprint
>>> pprint.pprint(r)
{'attempt': 1,
'hash': '29788eb987104b8a87d201292fa459d9',
'husband': 'Danny',
'response': b'{\n "args": {},\n "data": "",\n "files": {},\n "form": {\n "attempt": "1",\n "hash": "29788eb987104b8a87d201292fa459d9",\n "husband": "Danny",\n "url": "http://httpbin.org/post",\n "wife": "Audrey"\n },\n "headers": {\n "Accept": "*/*",\n "Accept-Encoding": "gzip, deflate",\n "Connection": "close",\n "Content-Length": "109",\n "Content-Type": "application/x-www-form-urlencoded",\n "Host": "httpbin.org",\n "User-Agent": "python-requests/2.3.0 CPython/3.3.5 Darwin/12.3.0",\n "X-Request-Id": "d25119e4-08ba-4523-abc4-b9a9ac10225b"\n },\n "json": null,\n "origin": "108.185.146.101",\n "url": "http://httpbin.org/post"\n}',
'status_code': 200,
'url': 'http://httpbin.org/post',
'wife': 'Audrey'}
由Webhooks驱动的项目
历史
0.4.2 (2014-05-22)
当使用Python 3时,将python-requests字节转换为字符串
0.4.1 (2014-05-22)
将 json262 替换为 standardjson 包。
0.4.0 (2014-05-20)
将 utils.encoders 替换为 json262 包。
在所有地方使用utf-8编码
在所有地方添加 from `__future__ import absolute_import。
0.3.2 (2014-05-17)
引入了简化的 cached_property 装饰器
0.3.1 (2014-05-15)
添加了更多可发送属性,以便更容易跟踪正在发生的事情。
在setup.py中添加了缺失的webhooks.sender包。
0.3.0 (2014-05-14)
添加了可扩展的Senderable类,以加快创建新发送者的过程。
添加了async_redis发送者。
添加了travis-ci。
0.2.0 (2014-05-13)
添加了功能性的钩子装饰器。
提高了测试覆盖率。
哈希函数被放置在自己的模块中。
感谢Audrey Roy Greenfeld,清理了JSON编码器!
0.1.0 (2014-05-07)
首次发布于PyPI。
项目详情
下载文件
下载适用于您平台的文件。如果您不确定选择哪一个,请了解更多关于安装包的信息。
源分布
构建分布
webhooks-0.4.2.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 092eefbd6da5f182b8629a63f90401b75ebf34a8079da60a747aef309201b2f9 |
|
MD5 | 550e3de702043bc9800f49a7ae4b1247 |
|
BLAKE2b-256 | 1075631a233b438e908cb938e16bed0cac176d16d0931d7d251980267bfa3556 |
webhooks-0.4.2-py2.py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | d705c5d8e6d3b485dae3071657360f22795b78bb0fa2652b00c7b086a2ffc05f |
|
MD5 | f8a08e50918d34d9fc6093acac6f02f2 |
|
BLAKE2b-256 | 62837db35bd3e26831bcc7f6970a5ff7668b9dcfb4898bb509e4e5b8a97756d4 |