I am not familiar with requests of python. I need to do one thing. here's a link:https://bugzilla.mozilla.org/buglist.cgi?bug_status=ASSIGNED&bug_status=REOPENED&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&query_format=advanced&resolution=---&resolution=FIXED&resolution=INVALID&resolution=WONTFIX&resolution=DUPLICATE&resolution=WORKSFORME&resolution=INCOMPLETE&resolution=SUPPORT&resolution=EXPIRED&resolution=MOVED&order=bug_id&limit=10
There is a button of xml below. If you click this button, you will get a xml page. I hope I can use python code to automatically get the xml content.
the html on that page of the xml button is :
<form method="post" action="show_bug.cgi"> <input type="hidden" name="ctype" value="xml"> <input type="hidden" name="id" value="35"> <input type="hidden" name="id" value="36"> <input type="hidden" name="id" value="37"> <input type="hidden" name="id" value="38"> <input type="hidden" name="id" value="39"> <input type="hidden" name="id" value="41"> <input type="hidden" name="id" value="42"> <input type="hidden" name="id" value="43"> <input type="hidden" name="id" value="51"> <input type="hidden" name="id" value="61"> <input type="hidden" name="excludefield" value="attachmentdata"> <input type="submit" value="XML" id="xml"> </form>
I tried to use requests. I tried code like this:
import requests
values = { 'submit': 'xml'}
req = requests.post('https://bugzilla.mozilla.org/buglist.cgi?bug_status=ASSIGNED&bug_status=REOPENED&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&query_format=advanced&resolution=---&resolution=FIXED&resolution=INVALID&resolution=WONTFIX&resolution=DUPLICATE&resolution=WORKSFORME&resolution=INCOMPLETE&resolution=SUPPORT&resolution=EXPIRED&resolution=MOVED&order=bug_id&limit=10',data=values)
print req.text
but I got errors.
can someone help me to point out the right usage of requests? Thanks.