get comment

This commit is contained in:
Kseninia Mikhaylova 2024-05-07 13:48:45 +03:00
parent 4be8a9583e
commit 04444ce0fb
1 changed files with 11 additions and 4 deletions

View File

@ -1,6 +1,6 @@
import requests
import json
from urllib.parse import urlparse, parse_qs
from urllib.parse import parse_qs
from fastapi import FastAPI, Request
from app.constants import *
@ -41,9 +41,16 @@ async def intgr(request: Request):
async def tg_intgr_get(request: Request):
try:
body = await request.body()
logger.info(body)
test = parse_qs(body)
logger.info(test)
query = parse_qs(body)
task_id = query[b"data[FIELDS_AFTER][TASK_ID]"][0].decode()
item_id = query[b"data[FIELDS_AFTER][ID]"][0].decode()
get_comment_hook = f"https://crm.svs-tech.pro/rest/38/7ufrqnfpncmt279p/task.commentitem.get.json?taskId={task_id}&ITEMID={item_id}"
data = requests.get(get_comment_hook)
comment = data.json()
logger.info(comment["result"])
return {"status": "success"}
except: