Creating an Epic from a Github Issue with Zenhub API

前端 未结 1 587
孤城傲影
孤城傲影 2021-01-25 08:42

This is a follow up question to How to set an issue pipeline with zenhub.

I\'m attempting to convert an issue to an epic in a Python script. I can convert the issue to a

1条回答
  •  温柔的废话
    2021-01-25 09:41

    I got this to work by adding 'Content-Type': 'application/json' to my headers and dumping the JSON body to a string, params = json.dumps({"issues": [{"repo_id": 280565, "issue_number": 17}]})

    My code now looks like:

    zenhub_headers = {"X-Authentication-Token": "%s" % token, 'Content-Type': 'application/json'}
    target_zh_issues_url = '%s/p1/repositories/%d/issues' % (zh_api_endpoint, target_repo_id)
    params = json.dumps({"issues": [{"repo_id": 280565, "issue_number": 17}]})
    response = requests.post(target_zh_issues_url + '/%s/convert_to_epic' % issue, headers=zenhub_headers, data=params)
    

    Though I'm not sure why the call with a body of unstringified {"issues":[]} was succeeding.

    0 讨论(0)
提交回复
热议问题