19

There are two python packages exist for jenkins remote access API, I need help to compare those two packages, so I can judge which to use.

So far for my thoughts:

  • python-jenkins is quite simple interface and is part of new Ubuntu release, which means easy to use, mature enough for general usage.

  • JenkinsAPI is mentioned in Jenkins official document, it looks new, but it is more connected with jenkins API development as well.

What I needed so far:

  • https access and simple authentication (token inside jenkins) : document is not clear both
  • get list of installed plugins (possible for those packages ?)
  • get list of jobs
  • get config xml from job
  • .. may needed for other exposed remote Access API later

I want to stick with python API in high level module, if possible, avoid to use python-requests module

Any more ideas ?

EDIT refine the questions after the comments below

Larry Cai
  • 55,923
  • 34
  • 110
  • 156
  • Have you tried them yourself? What problems did you encounter? What problem are you trying to solve here, what would you require the library to do? – Martijn Pieters Aug 09 '13 at 14:18
  • @martijn: thanks for remind, I updated with my analyse. – Larry Cai Aug 11 '13 at 13:53
  • You are not telling us what you want to do apart from using the secure tokens. What do you intend to script ? Do you absolutely need python? For example, there are other ways to access jenkins, for example the CLI: https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI which works with ssh keys. – coffeebreaks Aug 12 '13 at 06:53
  • coffeebreaks: thanks. I just want to have general comparison, also I want to stick with python for a moment. – Larry Cai Aug 12 '13 at 07:00
  • In _python-jenkins_, it is not possible to include a file as a parameter to build a job, while _jenkinsapi_ supports it. – tashuhka May 20 '15 at 16:18
  • 2
    Both of these libraries seem to lock you into their way of doing it. I looked at both and rejected both. You may be better off using the REST API directly with a decent url fetch library (e.g., urllib3, requests, etc.). – speedplane Dec 30 '15 at 20:02
  • in year 2021 the better option seems for me to be api4jenkins https://pypi.org/project/api4jenkins/ – YaP Jul 18 '21 at 20:28

1 Answers1

20

Given that both seem to have more or less the basic features and that JenkinsAPI is

  1. mentioned by the official documentation
  2. more active (jenkins-python history vs jenkinsapi history)

I would go for jenkinsapi.

As for token support, given the documentation, the fact that the code uses token in place of passwords for the API and is backward compatible with basic auth, I would say that any client that supports passwords will support tokens.

coffeebreaks
  • 3,787
  • 1
  • 26
  • 25
  • like the history link and the source codes on how to handle token/passwd, which makes me clear – Larry Cai Aug 12 '13 at 07:24
  • @coffeebreaks Thanks a ton! The backward compatible with basic auth saved a ton of time!! – suryakrupa Sep 14 '15 at 18:34
  • 4
    jenkins-python seemed to start getting more features and is hosted by openstack.org https://git.openstack.org/cgit/openstack/python-jenkins/ – Denis C Oct 18 '16 at 14:40
  • jenkins-python has a lot more features making its choice a no-brainer for any serious jenkins automation – akhan Dec 15 '16 at 21:59
  • 1
    Jenkinsapi just doesn't work for big instances: https://github.com/pycontribs/jenkinsapi/issues/525 – Jimilian Jul 23 '17 at 21:01
  • it's weird the python one recommends ast.literal_eval rather than json.loads :/ – Andy Hayden Aug 04 '17 at 04:57