Skip to content

GuillaumeFalourd/webhooks-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

webhooks-python

Security Pipeline Call webhook remote

POC of sending and receiving webhooks in Python 🐍

References

Usage

First, if you don't have the dependencies installed on your computer, run:

pip install -r requirements.txt

πŸ“€ Sender (Remote)

You will be able to send a webhook request remotely running the webhook_remote.py file by using python webhook_remote.py.

Check the request output here

Note: You can update the webhook online url on the webhook_remote.py file by creating your own for free on the Webhook site.

Demo Sender (Remote)

➜ python webhook_remote.py
Success

Screen Shot 2021-12-14 at 10 31 24


πŸ“₯ Receiver

You will be able to run the server by using python server.py.

Demo Receiver

➜  python server.py
 * Serving Flask app 'server' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

Accessing the http://127.0.0.1:5000/ on your navigator, you'll see somthing like this:

Screen Shot 2021-12-14 at 10 45 11


πŸ“€ Sender (Local)

You will be able to send a webhook request locally to the server above running the webhook_local.py file by using python webhook_local.py (on another terminal than the one where the server.py script is running).

Demo Sender (Local)

➜ python webhook_local.py
Success

If you do so, the terminal with the server.py script running will return the JSON it received:

➜  python server.py
 * Serving Flask app 'server' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
{'name': 'Guillaume', 'phone': '+553499999-9999', 'email': 'guillaume@test.com'}
127.0.0.1 - - [14/Dec/2021 10:48:06] "POST /webhook HTTP/1.1" 200 -

About

POC of sending and receiving webhooks in Python 🐍

Topics

Resources

Stars

Watchers

Forks

Languages