Jenkins, Kerberos and Python
Trying to talk to Jenkins while authenticating with Kerberos and getting
GSSException: No credential found for: 1.2.840.113554.1.2.2 usage: Accept
Using requests_gssapi and specifying SPNEGO
:
import gssapi
import requests
from requests_gssapi import HTTPSPNEGOAuth
login = 'http://jenkins/login'
job = 'http://jenkins/view/.../job/.../'
# GSSException: No credential found for: 1.2.840.113554.1.2.2 usage: Accept
spnego = gssapi.mechs.Mechanism.from_sasl_name("SPNEGO")
s = requests.Session()
rl = s.get( login, auth=HTTPSPNEGOAuth( mech=spnego ) )
rj = s.get( job )
works for me.