0

I'm wondering how I can add a description to builds in Jenkins by using Python module "requests"

I tried to make a POST request. The status code is 200 but the description is not added.

import requests
import json

url = 'http://localhost:8080/job/IgorModuleA-trunk/301/submitDescription'
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
creds = ('', '')
message = {'description': 'The build is failed'}
r = requests.post(url, data=json.dumps(message), headers=headers, auth=creds)
Ivan Vinogradov
  • 4,269
  • 6
  • 29
  • 39
  • when making `POST` with json, use `json=message` instead of `data=json.dumps(message)` and remove `Content-Type` header from `headers` – Ivan Vinogradov Sep 04 '19 at 10:37
  • @IvanVinogradov I made a request but it didn't help – Ihor Pysmennyi Sep 04 '19 at 13:15
  • I would try changing your POST request according to https://stackoverflow.com/questions/25427622/changing-jenkins-build-name-description-through-api-in-java – alex Sep 05 '19 at 15:00

0 Answers0