initial commit

This commit is contained in:
2025-11-09 12:26:46 -03:00
commit b305173b9d
17 changed files with 307 additions and 0 deletions

30
main.py Normal file
View File

@@ -0,0 +1,30 @@
import logging
from starlette.requests import Request
from starlette.responses import Response
import uvicorn
from fastapi import FastAPI, Form, UploadFile, File
import ntfy_service
from converter import read_brokerage_pdf, read_dividends_xlsx
import io
app = FastAPI()
logger = logging.getLogger(__name__)
logging.basicConfig(filename='rico-to-ghostfolio.log', level=logging.INFO)
@app.post("/brokerage")
async def convert_pdf(file: UploadFile = File(...)):
return read_brokerage_pdf(file)
@app.post("/b3dividends")
async def convert_pdf(file: UploadFile = File(...)):
return read_dividends_xlsx(file)
@app.post("/notification")
async def notification(request: Request):
message = await request.body()
return ntfy_service.send_notification(message.decode('utf8'))
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)