403 forbidden error on calling jenkins post api from python script I am trying to build a python script that will build jobs externally but when I am executing it, throws 403 forbidden error for build jobs call other get APIs are working fine. Below is the python snippet.

j=jenkins.Jenkins('http://localhost:8080/login?from=%2F', 'admin', 'admin@123' )

j.get_jobs();

print(j.jobs_count());

print(j.get_jobs());

j.build_job('demo1');


Jenkins details: I am able to create &amp; build jobs from UI successfully. My Jenkins version is 2.237.

Other settings.


logged in user can do anything. Csrf protection is disabled.
On the other hand my friend having the same script and version of Jenkins is able to build job.
As recommended by Jenkins (&gt;2.2xx) you may benefit by creating an API token for the user, I did so, to trigger Jenkins job in my local Jenkins server from NODEJS code.
Please refer below for further clarification:

https://www.jenkins.io/doc/book/system-administration/authenticating-scripted-clients/#shell-with-curl
https://www.jenkins.io/doc/book/using/remote-access-api/#RemoteaccessAPI-CSRFProtection

And for details: https://www.jenkins.io/doc/book/managing/security/