Skip to main content

Webhook creator and deployer

Project description

= AnyWebHook

AnyWebhook (*awh*) is Python/WSGI webhook listener and handler. It simplifies
writing and acting upon incoming webhooks.

Awh splits webhook handling into _validating_ and _executing_. You must register
both validator and executor to handle webhooks. These are simple functions which
accept a single request parameter containing incoming request data. Many
validators and executors (for many different webhooks) can be registered. Any
validator returning `True` marks webhook as correct.

You can also affect application's response by registering a separate function
accepting incoming request and to-be-modified response parameter.

Simple application would look like this:

[[example-app]]
[source,python]
----
import json
import subprocess

from awh import Awh
from awh.operate import require, jsonpath

app = Awh()

@app.validator('foo')
def valid(request):
payload = request.get_data(as_text=True)
j = json.loads(payload)

# validate incoming json somehow
require(jsonpath(j, 'password')[0].value == 'secretpass')
return True


@app.executor('foo')
def execute(request):
subprocess.call('deploy-app')


@app.app
def myapp(request, response):
response.status_code = 404
----

For additional examples, see link:tests/apps[tests/apps].

== Deployment

In <<example-app>>, `app` is a WSGI application, which implements its interface
(i.e. a function accepting `environ` and `start_response` parameters). You
should point it to your WSGI server.

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

awh-0.1.0.tar.gz (12.2 kB view details)

Uploaded Source

File details

Details for the file awh-0.1.0.tar.gz.

File metadata

  • Download URL: awh-0.1.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for awh-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cf9fc96fd5dd28b9393821222e978a9996a375dd32cf0148d1430d4a48f7f2d2
MD5 d38031ac0b92aa5504af58687688a343
BLAKE2b-256 7b1cfd87119efecb04006294058a4f973b22350ae370edd25fa45000a6a04e18

See more details on using hashes here.

Supported by

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