Thanks for the explanation for updating job config files. I've tried this method but it doesn't work for me. Can you please let me know if this method currently works for you.
I have also tried that method, doesn't work, also unable to create_job as well, keep failing.I also tried creating a requests still getting 403 errors: here is the code below I have tried, but keep failing:
Comments
2 comments
Hi,
Thanks for the explanation for updating job config files. I've tried this method but it doesn't work for me. Can you please let me know if this method currently works for you.
Thank you.
I have also tried that method, doesn't work, also unable to create_job as well, keep failing.I also tried creating a requests still getting 403 errors:
here is the code below I have tried, but keep failing:
```
import requests
auth = (user, pswd)
#print(auth)
crumb_data= requests.get("{0}/crumbIssuer/api/json".format(url),auth=auth,headers={'content-type': 'application/json'}, verify=False)
sessionID = crumb_data.headers['X-Jenkins-Session']
print(sessionID)
print("HAL CRUMB: {}".format(crumb_data.json()['crumb']))
job_url = "{}/{}".format(url,url_job)
headers = {
'Connection': 'keep-alive',
'Cache-Control': 'no-cache',
'Content-Type': 'application/json',
'Content-Encoding': 'gzip',
'Jenkins-Crumb': crumb_data.json()['crumb'],
'X-Jenkins-Session': sessionID
}
pprint(headers)
response = requests.post(job_url, headers=headers, data=params, verify=False)
print(response.text.encode('utf8'))
```
Please sign in to leave a comment.