Quick Start
Installation
To use this Python Jenkins SDK, first install it using pip:
(venv) $ pip install jenkins-pysdk
Next, test the connection to your application:
To test the connection to the instance,
you can explicitly run jenkins.connect() function:
- jenkins.Jenkins.connect()
Test the connection to the Jenkins instance.
- Returns:
Object containing connection information.
- Return type:
- Raises:
JenkinsConnectionException – If a connection exception occurs.
JenkinsUnauthorisedException – If the credentials aren’t valid.
For example (using an API token):
import jenkins_pysdk.jenkins as jenkins
conn = jenkins.Jenkins(host="JenkinsDNS", username="admin", token="11e8e294cee85ee88b60d99328284d7608")
print(conn.connect())
The above code will output:
request=<HTTPRequestObject object at 2430739526048> response=<HTTPResponseObject object at 2430750139600> content='[200] Successfully connected to JenkinsDNS.' status_code=200