0

我正在尝试使用其他 API 在 redmine 中发布问题,我正在使用 python 脚本来执行此操作:

这是我的脚本:

import requests
import json

username = "x"
password = "x"

url = "http://localhost:3000/issues.json"
data = open('rest.json', 'rb')

r = requests.post(url, auth=(username, password), data=data)

print(r.status_code) 
print(r.text)

这是我要发布的 JSON

{
    "issue" : {
        "id" : 2,
        "projet_id" : 1,
        "tracker_id" : 1,
        "priority_id" :1,
        "status_id" : 1,
        "author_id" : 1,
        "subject" : "Subject changed",
        "description": "The subject was changed",
        "category_id" :1,
        "assigned_to_id" : 1        
    }
}  

问题是每次我遇到错误 422 告诉我“问题不能为空,跟踪器不能为空,状态也不能为空”

你们能帮我吗?

谢谢你

4

0 回答 0