I tried to use curl to create job , it's done successfully. But when I use python tempfile or python jenkins API ,server return a 500 error.
```
def create_job(job_name, config_xml):
headers = {'Content-Type': 'text/xml'}
f = tempfile.NamedTemporaryFile()
f.write(config_xml)
f.flush()
f.seek(0)
print f.read()
re = requests.post(jenkins_url + "createItem?name=" \
+ job_name, auth=(user_id, password), headers=headers, data=f.read())
if re.status_code == requests.codes.ok:
return True
else:
print re.text
return False
```