From: salimfadhley Date: Sun, 16 Jun 2013 14:48:00 +0000 (+0100) Subject: This is the actual correct way to generate a new view. Ignore my previous effort. X-Git-Tag: v0.2.23~172 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e0aa58a204350f332d519f2ad132c454956ae5aa;p=tools%2Fpython-jenkinsapi.git This is the actual correct way to generate a new view. Ignore my previous effort. --- diff --git a/examples/create_a_view_low_level.py b/examples/create_a_view_low_level.py index b3b4ca4..56075e8 100644 --- a/examples/create_a_view_low_level.py +++ b/examples/create_a_view_low_level.py @@ -5,15 +5,17 @@ This is how JenkinsAPI creates views import requests import json -url = 'http://localhost:8080/newView' -str_view_name = "ddsfddfd" +url = 'http://localhost:8080/createView' + +str_view_name = "blahblah123" params = {}# {'name': str_view_name} headers = {'Content-Type': 'application/x-www-form-urlencoded'} data = { + "name": str_view_name, "mode": "hudson.model.ListView", - #"Submit": "OK", - "name": str_view_name + "Submit": "OK", + "json": json.dumps({"name": str_view_name, "mode": "hudson.model.ListView"}) } # Try 1 -result = requests.post(url, params=params, data={'json':json.dumps(data)}, headers=headers) +result = requests.post(url, params=params, data=data, headers=headers) print result.text.encode('UTF-8')