fetch jenkins username/password from .netrc

Bug #941400 reported by Domen Kožar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Python Jenkins
Fix Released
Wishlist
Unassigned

Bug Description

It would be really useful if python-jenkins would fetch http authentication details from .netrc

James Page (james-page)
Changed in python-jenkins:
importance: Undecided → Wishlist
Revision history for this message
lonetwin (lonetwin) wrote :

The python standard library comes with a netrc module ( https://docs.python.org/3.5/library/netrc.html ) for a long while now . Using that to extract the credentials is as simple as:

import netrc
...
...
netrc_cfg = netrc.netrc() # defaults to using ~/.netrc
username, _, password = netrc_cfg.authenticators('server.name')

...which can then be use to construct the Jenkins instance from python-jenkins.

If however, the maintainer feels like this would be good to build into python-jenkins itself, I'm happy to submit a patch.

Revision history for this message
Sorin Sbarnea (ssbarnea) wrote :

I am the current maintainer, feel free to implement it. My impression is that this may be already working since we switched to request library.

Changed in python-jenkins:
assignee: nobody → Sorin Sbârnea (sorin-sbarnea)
Revision history for this message
Tobias Gruetzmacher (tobix) wrote :

I can confirm this is working with python-jenkins 1.4.0 - it has probably worked since 1.0.0

Sorin Sbarnea (ssbarnea)
Changed in python-jenkins:
assignee: Sorin Sbarnea (ssbarnea) → nobody
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.