File: example_param_build.py

package info (click to toggle)
python-jenkinsapi 0.3.17-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,500 kB
  • sloc: python: 10,001; xml: 50; makefile: 31; sh: 26
file content (19 lines) | stat: -rw-r--r-- 520 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import json
import requests


def foo():
    """
    A low level example of how JenkinsAPI runs a parameterized build
    """
    toJson = {"parameter": [{"name": "B", "value": "xyz"}]}
    url = "http://localhost:8080/job/ddd/build"
    # url = 'http://localhost:8000'
    headers = {"Content-Type": "application/x-www-form-urlencoded"}
    form = {"json": json.dumps(toJson)}
    response = requests.post(url, data=form, headers=headers)
    print(response.text.encode("UTF-8"))


if __name__ == "__main__":
    foo()