import xmlrpclib
import pprint
import operator

# Create an object to represent our server.
query_url = 'https://bugzilla.redhat.com/xmlrpc.cgi';
query = xmlrpclib.Server(query_url);

# Call the server and get our result.
bugs = (query.Bug.search({'votes': 200,'product':'Fedora'})).get('bugs')
#result1 = result.get('bugs')
bugs.sort(key=lambda x: x['votes'], reverse=True)
i=0
print "Top 20 bugs by vote"
print "+++++++++++++++++++++++++++++\n"
for bug in bugs:
	if((bug['bug_status'] == "ASSIGNED" or bug['bug_status'] == "OPEN") and (bug['bug_status'] != "NEW" and bug['bug_status'] != "CLOSED" and bug['bug_status'] != "VERIFIED" and bug['bug_status'] != "RESOLVED" and bug['bug_status'] != "REOPENED") and i <= 20):
		print "Assigned to: "+bug['assigned_to']
		print "Bug ID: "+str(bug['bug_id'])
		print "Bug Severity: "+bug['bug_severity']
		print "Bug Status: "+bug['bug_status']
		print "Operating System: "+bug['op_sys']
		print "Priority: "+bug['priority']
		print "Product: "+bug['product']
		print "Resolution: "+bug['resolution']
		print "Short Description: "+bug['short_desc']
		print "Votes: "+str(bug['votes'])
		print "+++++++++++++++++++++++++++++"
		print ""
		i=i+1