add requests

This commit is contained in:
aarizona 2024-05-02 12:22:53 +03:00
parent 6c99a01bcb
commit 710557c83f
2 changed files with 11 additions and 8 deletions

View File

@ -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"}

View File

@ -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]