Webhook wrapper for ko-fi
Project description
Mofi
A simple webhook wrapper for Ko-fi
Mofi uses FastAPI to handle the webhooks.
Installation
pip install mofi
Usage
from mofi import Mofi, Donation, GlobalType, Subscription, ShopOrder
mofi = Mofi(token="token")
@mofi.callback("donation")
async def donation(data: Donation):
print("Donation event.")
@mofi.callback("subscription")
async def subscription(data: Subscription):
print("Subscription event")
@mofi.callback("shop_order")
async def shop_order(data: ShopOrder):
print("Shop Order event")
@mofi.callback("global")
async def global_callback(data: GlobalType):
print("Global event") # matches all event types
mofi.run(host="127.0.0.1", port=8000) # use 0.0.0.0 and 80 on delpoyment
To get your token, go here and click "Advanced"
To test, use ngrok or similar to expose your local server to the internet.
$ ngrok http 8000
Then, set your webhook url to the ngrok url and you should see the events in your console.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mofi-0.1.0.tar.gz
(3.8 kB
view hashes)
Built Distribution
mofi-0.1.0-py3-none-any.whl
(4.5 kB
view hashes)