如何通过python请求在JIRA中填写服务请求表

问题描述

我正在尝试在JIRA的服务请求中发布表格。为此,我可以进行身份​​验证并获取Cookie。使用cookie,我试图创建一个服务请求,但是从服务器中收到了400个错误。有人可以纠正我在做什么错误吗?任何帮助表示赞赏。

enter image description here

enter image description here

import requests,logging
from requests import Session

logging.basicConfig(level=logging.DEBUG)
USERNAME = ""
PASSWORD = ""
s = Session()
base_url = "https://jira.company.com"
session_response = s.post(base_url + "/rest/auth/1/session",json={"username": USERNAME,"password": PASSWORD})
# create the issue with this url https://jira.company.com/servicedesk/customer/portal/1/create/20
jira_post_url = base_url + "/servicedesk/customer/portal/1/create/20"
cookie = session_response.cookies
token = dict(session_response.cookies).get("atlassian.xsrf.token")
headers = {"Content-Type": "application/json"}
data = {
    'atl_token': token,'projectId': 12704,'reporter': 'testuser@gmail.com','customfield_11615': 'test1234','customfield_11526': '5/Oct/20','priority': '3','customfield_11528': '','sd-kb-article-viewed': False
}
response = requests.request("POST",jira_post_url,data=json.dumps(data),cookies=cookie)
print(response.status_code)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...