Has it ever been resolved somehow? So far this is the only solution I could find.
OS: Windows 10 1809 Python: 3.7.2 Python-jenkins: 1.5.0 Requests: 2.11.1 -- You received this bug notification because you are a member of Python Jenkins Developers, which is subscribed to Python Jenkins. https://bugs.launchpad.net/bugs/1799107 Title: Jenkins HTTPS Basic Auth fails with Python 3.5 Status in Python Jenkins: New Bug description: Hi, I tried the example one from the document with python-jenkins 1.3.0 on Ubuntu 16.04.5 x64 with stock Python 3.5.2 with HTTPS and SSL cert verification disabled : ===== import os import jenkins os.environ['PYTHONHTTPSVERIFY'] = "0" server = jenkins.Jenkins('https://<my jenkins server>:8443/jenkins', username='user', password='password') user = server.get_whoami() version = server.get_version() print('Hello %s from Jenkins %s' % (user['fullName'], version)) ====== And I got this error: jenkins.JenkinsException: Error in request. Possibly authentication failed [401]: After digging into python-jenkins code, I found out this one at line 317 in __init__.py: ===== if username is not None and password is not None: self._auths[0] = ( 'basic', requests.auth.HTTPBasicAuth( username.encode('utf-8'), password.encode('utf-8')) ) ===== the "encode('utf-8')" would make username and password binary strings and in requests.auth: ===== def _basic_auth_str(username, password): """Returns a Basic Auth string.""" authstr = 'Basic ' + to_native_string( b64encode(('%s:%s' % (username, password)).encode('latin1')).strip() ) return authstr ===== the parameter passed to b64encode() would become "b'user':b'password'" so the authentication would fail. So far I remove encode('utf-8') in __init__.py so it would work. Just curious: is it my problem or how would this work with encode('utf-8') ? OS: Ubuntu 16.04.5 X64 Python: 3.5.2 (stock) Python-jenkins: 1.3.0 requests: 2.9.1 Thanks for your attention. ywliu To manage notifications about this bug go to: https://bugs.launchpad.net/python-jenkins/+bug/1799107/+subscriptions -- Mailing list: https://launchpad.net/~python-jenkins-developers Post to : python-jenkins-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~python-jenkins-developers More help : https://help.launchpad.net/ListHelp