diff --git a/app/main.py b/app/main.py index 73fbf19..5760264 100644 --- a/app/main.py +++ b/app/main.py @@ -1,3 +1,5 @@ +import requests +import json from fastapi import FastAPI, Request from app.constants import logger @@ -14,16 +16,16 @@ def read_root(): async def intgr(request: Request): body = await request.json() ref = body["ref"] - branch = ref.split('/')[-1] - [tag, number, *args] = branch.split('-') + branch = ref.split("/")[-1] + [tag, number, *args] = branch.split("-") logger.info(f"input tag {tag} number {number} args {args}") - - if number == 'test': + + if number == "test": number = 423 - - bx_res = request.get( + + bx_res = requests.get( "https://crm.svs-tech.pro/rest/38/7ufrqnfpncmt279p/task.commentitem.add.json?" f"taskId={number}&fields[POST_MESSAGE]=f'{body['commits'][0]['message']}'" - ) - logger.info(f"result {bx_res}") + ) + logger.info(f"result {json.loads(bx_res.text)}") return {"status": "success"} diff --git a/pyproject.toml b/pyproject.toml index 6222fa7..b71a80b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,6 +11,7 @@ python = "^3.10" fastapi = "^0.110.3" uvicorn = "^0.29.0" python-dotenv = "^1.0.1" +requests = "^2.31.0" [tool.poetry.group.dev.dependencies]