Coder Social home page Coder Social logo

webhooks-python-example's Introduction

Scalr Example Webhook App

This Python web application is meant to serve as a base for you to build a Scalr Webhook Handler.

The application integrates the following:

  • Signature validation
  • Request parsing

To add your own logic, all you have to do is extend the webhook_post_handler function in app.py.

Usage

To deploy the app, you can:

  • Add it to an instance you own, install its dependencies
  • Use a PaaS, either deployed on your own infrastructure (CloudFoundry), or on public infrastructure (e.g. Heroku)

Installing Dependencies

To install the app's dependencies, do the following:

  • Ensure that you have the Python Pip installer available on your system
  • Run pip install -r requirements.txt, from the root of the project

Configuring the app

The application is configured by passing its configuration through environment variables (i.e. it's a 12-factor app).

If you are using Honcho or Foreman (as suggested below), you can simply input those environment variables in the .env file.

The following environment variable is used:

  • SIGNING_KEY: This should be the signing key provided by Scalr, used to authenticate requests.

Running the app

Once you have installed and configured the app, you can launch it by running honcho start web. The app will listen on port 5000 by default.

If you're launching the app on an instance, you'll probably want to daemonize it. To do so, navigate to the app directory, and then run:

gunicorn --daemon --bind 0.0.0.0:5000 app:app

Bear in mind that gunicorn will not read your .env file, so you have to pass the SIGNING_KEY environment variable through other means.

One option is:

SIGNING_KEY=yyyy gunicorn --daemon --bind 0.0.0.0:5000 app:app

For further information, you should check the Gunicorn documentation.

Further reading

For more information, you should refer to our Webhooks Documentation.

Issues

Please report issues and ask questions on the project's Github repository, in the issues section.

License

View LICENSE.

webhooks-python-example's People

Contributors

krallin avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.