On these pages:
https://ci.jenkins-ci.org/api/
The instructions for using Python say:
> Access the same data as Python for Python clients. This can be parsed into
> Python object as eval(urllib.urlopen("...").read()) and the resulting
> object tree is identical to that of JSON. However, when you do this, beware
> of the security implication. If you are connecting to a non-trusted
> Jenkins, the server can send you malicious Python programs.
>
> In Python 2.6 or later you can safely parse this output using
> ast.literal_eval(urllib.urlopen("...").read())
>
Actually, in Python 2.6 or later, the best way for reading these responses
is to use the regular JSON API, and use the (new in 2.6) json module to
read them:
json.loads(urllib.urlopen("...").read())
Not only does this make more sense -- it's also faster (in my test with the
above URL, about 5 times faster).
So -- the Python-specific API is only for those who use Python <2.6 and
don't care about security (if they do care, there are 3rd party JSON
parsers).
Noam.