This commit is contained in:
aarizona 2024-05-02 13:08:58 +03:00
parent 7a395c14b1
commit f0af5af3e8
3 changed files with 9 additions and 10 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
.venv/ .venv/
.vscode/ .vscode/
__pycache__/ __pycache__/
poetry.lock poetry.lock
.env

View File

@ -1,5 +1,5 @@
import os
import logging import logging
import uuid
from dotenv import load_dotenv from dotenv import load_dotenv
load_dotenv() load_dotenv()
@ -9,3 +9,5 @@ logging.basicConfig(
) )
logging.getLogger("httpx").setLevel(logging.WARNING) logging.getLogger("httpx").setLevel(logging.WARNING)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
WEBHOOK = os.getenv('WEBHOOK')

View File

@ -1,7 +1,8 @@
from typing import Union import requests
from fastapi import FastAPI import json
from fastapi import FastAPI, Request
from app.constants import logger from app.constants import *
app = FastAPI() app = FastAPI()
@ -12,10 +13,6 @@ def read_root():
@app.post("/integration") @app.post("/integration")
<<<<<<< Updated upstream
def intgr(body):
logger.info(body)
=======
async def intgr(request: Request): async def intgr(request: Request):
body = await request.json() body = await request.json()
ref = body["ref"] ref = body["ref"]
@ -37,5 +34,4 @@ async def intgr(request: Request):
f"&fields[POST_MESSAGE]={bx_comment}" f"&fields[POST_MESSAGE]={bx_comment}"
) )
logger.info(f"result {json.loads(bx_res.text)}") logger.info(f"result {json.loads(bx_res.text)}")
>>>>>>> Stashed changes
return {"status": "success"} return {"status": "success"}