Python API to build Jenkins job


Generate API token key
Log in to Jenkins.
Click you name (upper-right corner).
Click Configure (left-side menu).
Use "Add new Token" button to generate a new one then name it.
You must copy the token when you generate it as you cannot view the token afterwards.
Revoke old tokens when no longer needed.

with this python you are able to execute Jenkins build

if Jenkins not installed then use
pip install python-jenkins

import jenkins
#parameters: jenkins url, username, token (created in Jenkins)
username = "xxxxxx"
token = "!fdghfjry6576hdkfkfllkldj876!"
server = jenkins.Jenkins("http://localhost:8080/", username, token)
server.build_job("<job name>")

tested in win10 as localhost