I am not able to retrieve every information (such as comments, attachments, estimated time...) from a bug on Bugzilla (my version is 4.2.5) using it's Webservice. I have all the IDs of the bugs and am trying to access they're according URL to get the XML format of the bug.
I am told that the Bugzilla API doesn't allow access via cookies. So I have the following but I keep getting stuck at the login page even when providing the correct username and password. Here is what I have so far:
pf = {'username' : 'my_username', 'password' : 'my_password' }
fields = urllib.urlencode(pf)
pageContents = StringIO.StringIO()
p = pycurl.Curl()
p.setopt(pycurl.FOLLOWLOCATION, 1)
p.setopt(pycurl.COOKIEFILE, './cookie_test.txt')
p.setopt(pycurl.COOKIEJAR, './cookie_test.txt')
p.setopt(pycurl.POST, 1)
p.setopt(pycurl.POSTFIELDS, fields)
p.setopt(pycurl.WRITEFUNCTION, pageContents.write)
p.setopt(pycurl.VERBOSE, True)
p.setopt(pycurl.DEBUGFUNCTION, test)
p.setopt(pycurl.URL, 'http://ift.tt/1x69SWU]')
p.perform()
p.close() # This is mandatory.
pageContents.seek(0)
for x in pageContents.readlines() :
print x
So what I get displayed is the following:
<html lang="en">
<head>
<title>Log in to Website</title>
.
.
.
This means that I am still at the login page. Any suggestions?
Let me know if further explanation is required.
No comments:
Post a Comment