Hi all,
I'm trying to write a plugin to do some simple queryies in jira. What shall I do first is to log in jira, right? I do it in the following way:
#!/usr/bin/env python
import urllib
import httplib
import json
test_data = {"username":"username","password":"password"}
test_data_urlencode = json.JSONEncoder().encode(test_data)
requrl = 'https://company.com/rest/auth/1/session'
headerdata = {"Content-Type":"application/json"}
conn = httplib.HTTPConnection("company.com")
conn.request(method="POST",url=requrl,body=test_data_urlencode,headers = headerdata)
response = conn.getresponse()
res= response.read()
print res
But I got output like this:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://company.com//rest/auth/1/session">here</a>.</p>
</body></html>
Could you help me fix this? Thank you.