3

I am trying to change the assignee in JIRA using pycurl. My code is waiting on ****HTTP/1.1 100 Continue****. What am I doing wrong? Thanks for your help. I have attached a snippet of my code below. Also I do not want to use the JIRA Python Library.

def assign(self, key, name):

    data = json.dumps({"fields":{"assignee":{"name":name}}}) 
    c= pycurl.Curl()
    c.setopt(pycurl.VERBOSE, 1)
    c.setopt(pycurl.URL, "http://xxx/rest/api/2/issue/"+ key )
    c.setopt(pycurl.HTTPHEADER, ['Content-Type: application/json', 'Accept: application/json'])
    c.setopt(pycurl.USERPWD, "****") 
    c.setopt(pycurl.PUT, 1) 
    c.setopt(pycurl.POSTFIELDS,data)
    c.perform()
Robᵩ
  • 163,533
  • 20
  • 239
  • 308
HighonH
  • 169
  • 3
  • 16
  • What are you trying to achieve? How to reproduce your problem? – Ben Beirut Aug 20 '15 at 18:21
  • I want to change to whom the ticket is assigned to in JIRA. To reproduce the problem you need access to JIRA. I think there is some issue in how I am sending the data. The data here is the name. for eg.Fred – HighonH Aug 20 '15 at 20:13

1 Answers1

7

Got the code working.

   def assign(self, key, name):
    self._startCurl()         
    self.c.setopt(pycurl.URL, "http://xxx/rest/api/2/issue/"+ key )
    self.c.setopt(pycurl.HTTPHEADER, ['Content-Type: application/json', 'Accept: application/json'])
    self.c.setopt(pycurl.USERPWD, "fred:fred") 
    self.c.setopt(pycurl.CUSTOMREQUEST, "PUT")
    data = json.dumps({"fields":{"assignee":{"name":name}}})
    self.c.setopt(pycurl.POSTFIELDS,data)        
    self.c.perform()
    self.c.close()
HighonH
  • 169
  • 3
  • 16
  • Would not the use of POSTFIELDS results in a POST request rather than a PUT request? – vpp Dec 07 '22 at 00:00