Metadata-Version: 2.1
Name: mofi
Version: 0.1.1
Summary: Webhook wrapper for ko-fi
License: MIT
Author: Jedddy
Author-email: jedbalita25@gmail.com
Requires-Python: >=3.9,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: fastapi (>=0.109.0,<0.110.0)
Requires-Dist: python-multipart (>=0.0.6,<0.0.7)
Requires-Dist: uvicorn (>=0.25.0,<0.26.0)
Description-Content-Type: text/markdown

# Mofi

A simple webhook wrapper for [Ko-fi](https://ko-fi.com)

Mofi uses [FastAPI](https://fastapi.tiangolo.com/) to handle the webhooks.

## Installation

```bash
$ pip install mofi
```

## Usage

```python
from mofi import Mofi, Donation, GlobalType, Subscription, ShopOrder

app = Mofi(token="token")


@app.callback("donation")
async def donation(data: Donation):
    print("Donation event.")


@app.callback("subscription")
async def subscription(data: Subscription):
    print("Subscription event")


@app.callback("shop_order")
async def shop_order(data: ShopOrder):
    print("Shop Order event")


@app.callback("global")
async def global_callback(data: GlobalType):
    print("Global event")  # matches all event types


app.run(host="127.0.0.1", port=8000)  # use 0.0.0.0 and 80 on deployment
```
To get your token, go [here](https://ko-fi.com/manage/webhooks) 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.

