From 0e53f398bf2cf885393865ec1f899308bb56625b Mon Sep 17 00:00:00 2001 From: salimfadhley Date: Sun, 16 Jun 2013 01:53:01 +0100 Subject: [PATCH] Add a low-level example for creating views. --- examples/create_a_view_low_level.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 examples/create_a_view_low_level.py diff --git a/examples/create_a_view_low_level.py b/examples/create_a_view_low_level.py new file mode 100644 index 0000000..b3b4ca4 --- /dev/null +++ b/examples/create_a_view_low_level.py @@ -0,0 +1,19 @@ +""" +A low level example: +This is how JenkinsAPI creates views +""" +import requests +import json + +url = 'http://localhost:8080/newView' +str_view_name = "ddsfddfd" +params = {}# {'name': str_view_name} +headers = {'Content-Type': 'application/x-www-form-urlencoded'} +data = { + "mode": "hudson.model.ListView", + #"Submit": "OK", + "name": str_view_name +} +# Try 1 +result = requests.post(url, params=params, data={'json':json.dumps(data)}, headers=headers) +print result.text.encode('UTF-8') -- 2.7.4