add requests
This commit is contained in:
parent
6c99a01bcb
commit
710557c83f
18
app/main.py
18
app/main.py
|
@ -1,3 +1,5 @@
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
from fastapi import FastAPI, Request
|
from fastapi import FastAPI, Request
|
||||||
|
|
||||||
from app.constants import logger
|
from app.constants import logger
|
||||||
|
@ -14,16 +16,16 @@ def read_root():
|
||||||
async def intgr(request: Request):
|
async def intgr(request: Request):
|
||||||
body = await request.json()
|
body = await request.json()
|
||||||
ref = body["ref"]
|
ref = body["ref"]
|
||||||
branch = ref.split('/')[-1]
|
branch = ref.split("/")[-1]
|
||||||
[tag, number, *args] = branch.split('-')
|
[tag, number, *args] = branch.split("-")
|
||||||
logger.info(f"input tag {tag} number {number} args {args}")
|
logger.info(f"input tag {tag} number {number} args {args}")
|
||||||
|
|
||||||
if number == 'test':
|
if number == "test":
|
||||||
number = 423
|
number = 423
|
||||||
|
|
||||||
bx_res = request.get(
|
bx_res = requests.get(
|
||||||
"https://crm.svs-tech.pro/rest/38/7ufrqnfpncmt279p/task.commentitem.add.json?"
|
"https://crm.svs-tech.pro/rest/38/7ufrqnfpncmt279p/task.commentitem.add.json?"
|
||||||
f"taskId={number}&fields[POST_MESSAGE]=f'{body['commits'][0]['message']}'"
|
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"}
|
return {"status": "success"}
|
||||||
|
|
|
@ -11,6 +11,7 @@ python = "^3.10"
|
||||||
fastapi = "^0.110.3"
|
fastapi = "^0.110.3"
|
||||||
uvicorn = "^0.29.0"
|
uvicorn = "^0.29.0"
|
||||||
python-dotenv = "^1.0.1"
|
python-dotenv = "^1.0.1"
|
||||||
|
requests = "^2.31.0"
|
||||||
|
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
|
|
Loading…
Reference in New Issue