From f0af5af3e81620443a4e37d69c271e564b8b5a6b Mon Sep 17 00:00:00 2001 From: aarizona Date: Thu, 2 May 2024 13:08:58 +0300 Subject: [PATCH] env --- .gitignore | 3 ++- app/constants.py | 4 +++- app/main.py | 12 ++++-------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index dcdf512..8ec78fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .venv/ .vscode/ __pycache__/ -poetry.lock \ No newline at end of file +poetry.lock +.env \ No newline at end of file diff --git a/app/constants.py b/app/constants.py index 40c4966..73d4e8b 100644 --- a/app/constants.py +++ b/app/constants.py @@ -1,5 +1,5 @@ +import os import logging -import uuid from dotenv import load_dotenv load_dotenv() @@ -9,3 +9,5 @@ logging.basicConfig( ) logging.getLogger("httpx").setLevel(logging.WARNING) logger = logging.getLogger(__name__) + +WEBHOOK = os.getenv('WEBHOOK') \ No newline at end of file diff --git a/app/main.py b/app/main.py index b1db67a..7a0270a 100644 --- a/app/main.py +++ b/app/main.py @@ -1,7 +1,8 @@ -from typing import Union -from fastapi import FastAPI +import requests +import json +from fastapi import FastAPI, Request -from app.constants import logger +from app.constants import * app = FastAPI() @@ -12,10 +13,6 @@ def read_root(): @app.post("/integration") -<<<<<<< Updated upstream -def intgr(body): - logger.info(body) -======= async def intgr(request: Request): body = await request.json() ref = body["ref"] @@ -37,5 +34,4 @@ async def intgr(request: Request): f"&fields[POST_MESSAGE]={bx_comment}" ) logger.info(f"result {json.loads(bx_res.text)}") ->>>>>>> Stashed changes return {"status": "success"}