Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-23699

Problem creating jobs with Python using Jenkins API

    Details

    • Type: Improvement
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: python-plugin
    • Labels:
      None
    • Environment:
      Ubuntu 12.04 with Jenkins ver. 1.570
    • Similar Issues:

      Description

      Hello.

      I'm trying to create jobs in Jenkins using the Jenkins API and Python. When the same config.xml, using this Groovy, http://wiki.hudson-ci.org/display/HUDSON/Authenticating+scripted+clients, the jobs is correctly created. But, when trying to create with python, I'm getting the following error.

      http://pastebin.com/F17fwFr8

      How can I solved it?

      Thanks in advance.

      Sorry if the post is duplicated, I tried to find others similar issues.

        Attachments

          Activity

          Hide
          josegonzalez José Manuel González Maldonado added a comment -

          Finally, i solved it using urllib2 and base64.

          1. Make a POST request
            base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
            headers = {'X-Requested-With' : 'urllib2','Content-Type': 'text/xml; charset=UTF-8','Authorization': 'Basic %s' % base64string}

            req = urllib2.Request(url=url,data=input_send,headers=headers)
            response = urllib2.urlopen(req)

          Show
          josegonzalez José Manuel González Maldonado added a comment - Finally, i solved it using urllib2 and base64. Make a POST request base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '') headers = {'X-Requested-With' : 'urllib2','Content-Type': 'text/xml; charset=UTF-8','Authorization': 'Basic %s' % base64string} req = urllib2.Request(url=url,data=input_send,headers=headers) response = urllib2.urlopen(req)

            People

            • Assignee:
              Unassigned
              Reporter:
              josegonzalez José Manuel González Maldonado
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: