Skip to main content

Python + Webhooks mMade Easy

Project description

https://pypip.in/d/webhooks/badge.png https://badge.fury.io/py/webhooks.png Build Status Wheel Status

Python + Webhooks Made Easy

WARNING This project is in a pre-alpha state. It’s not ready for use on ANYTHING.

Python Versions

Currently works in:

  • Python 2.7

  • Python 3.3

Existing Features

  • Easy to integrate into any package or project

  • Comes with several built-in senders for synchronous webhooks.

  • Comes with a RedisQ-powered asynchronous webhook.

  • Extendable functionality through the use of custom senders and hash functions.

Planned Features

  • Comes with many built-in senders for synchronous and asynchronous webhooks.

  • Special functions for combining multiple sends of identical payloads going to one target into one.

  • Follows http://resthooks.org patterns

  • Great documentation

  • Compatibility with PyPy

Usage

Follow these easy steps:

  1. Import the webhook decorator.

  2. Define a function that returns a JSON-serializable dictionary or iterable.

  3. Add the webhook decorator and pass in a sender_callable.

  4. Call the function!

Synchronous example (async examples to come soon):

>>> 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'}

Projects Powered by Webhooks

History

0.4.1 (2014-05-22)

  • Replaced json262 with standardjson package.

0.4.0 (2014-05-20)

  • Replaced utils.encoders with json262 package.

  • utf-8 encoding everywhere

  • Add from `__future__ import absolute_import everywhere.

0.3.2 (2014-05-17)

  • Brought in simplified cached_property decorator

0.3.1 (2014-05-15)

  • Added more Senderable attributes to make it easier to track what’s going on.

  • Added the missing webhooks.sender package to setup.py.

0.3.0 (2014-05-14)

  • Added extensible Senderable class to expedite creating new senders.

  • Added async_redis sender.

  • Added travis-ci.

0.2.0 (2014-05-13)

  • Added functioning hook decorator.

  • Ramped up test coverage.

  • Hash functions placed in their own module.

  • Cleaned up JSON encoder thanks to Audrey Roy Greenfeld!

0.1.0 (2014-05-07)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

webhooks-0.4.1.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

webhooks-0.4.1-py2.py3-none-any.whl (10.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file webhooks-0.4.1.tar.gz.

File metadata

  • Download URL: webhooks-0.4.1.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for webhooks-0.4.1.tar.gz
Algorithm Hash digest
SHA256 2b57e878b4eac6bd0b506b7c3375ba6581537c977a6540b1e7f576ee19708988
MD5 8fe6c1c27957f79e675510f7f869f8d2
BLAKE2b-256 ce3fc9375c39fcaaec70aa42df844e3d1a98bcf50fd0c08202e89c8a57c738db

See more details on using hashes here.

File details

Details for the file webhooks-0.4.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for webhooks-0.4.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 232a3d750c8eac6b4b8a838e24822fb88f65a72651c8df7f035b2e9fe193014b
MD5 66a3ff58f95cc8ce7443b53511643c5d
BLAKE2b-256 af709604a954e2da4d2fbe36b9434abe246b7868ddb1e72be7472472d480c302

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page