pyral新手,正在尝试向用户故事中添加任务。复制粘贴已经可用,“似乎工作”的代码从网络。
代码:
target_story = rally.get('UserStory', query='FormattedID = %s' % storyID, instance=True)
info = {
"Project" : project,
"WorkProduct" : target_story.ref,
"Name" : "USER of of ",
"State" : "Defined",
"TaskIndex" : 1,
"Description" : "FXYZ.",
"Estimate" : 2.0,
"Actuals" : 1.0,
"ToDo" : 1.0,
"Notes" : "XYZ"
}
task = rally.put('Task', info)我收到以下错误:
Traceback (most recent call last):
File "...projects/Timer/task.py", line 113, in <module>
main()
File "...projects/Timer/task.py", line 70, in main
task = rally.put('Task', info)
File "...Python27\lib\site-packages\pyral\restapi.py", line 947, in put
response = RallyRESTResponse(self.session, context, resource, response, "shell", 0)
File "...\Python27\lib\site-packages\pyral\rallyresp.py", line 117, in __init__
self.content = json.loads(response.content)
File "...\Python27\lib\json\__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "...\Python27\lib\json\decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "...\Python27\lib\json\decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded提前谢谢。注:已检查:https://github.com/RallyTools/RallyRestToolkitForPython/issues/21 pyral版本: 1.1.1
发布于 2017-04-09 15:50:25
我已经更新了上面给出的代码,现在它可以工作了:
target_story_req = rally.get('UserStory', query='FormattedID = %s' % storyID)
target_story = target_story_req.next()
project_req = rally.get('Project', fetch=True, query='Name = "%s"' % (projectID))
project = project_req.next()
info = {
"Project" : project.ref,
"WorkProduct" : target_story.ref,
"State" : "Defined",
"TaskIndex" : 1,
"Description" : "FXYZ.",
"Estimate" : 2,
"Actuals" : 1,
"ToDo" : 1,
"Notes" : "XYZ"
}
task = rally.create('Task', info)https://stackoverflow.com/questions/36184235
复制相似问题