Bug 1104197

Summary: Cant query bugzilla with python3
Product: [Fedora] Fedora Reporter: Josef Stribny <jstribny>
Component: python-bugzillaAssignee: Cole Robinson <crobinso>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: bugs.michael, crobinso, dzickus, hhorak, jskarvad, wwoods
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-05 17:59:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch that solves the issue by making a string out of request_body for POST none

Description Josef Stribny 2014-06-03 13:28:31 UTC
Created attachment 901788 [details]
Patch that solves the issue by making a string out of request_body for POST

Description of problem:

I can't query Bugzilla with Python 3


How reproducible:

You can test it with the following script:

from bugzilla import Bugzilla
base_query = {'query_format': 'advanced'}
query = {'component': 'rubygem-rails'}
query.update(base_query)
rpc_conf = {'url': 'https://bugzilla.redhat.com/xmlrpc.cgi',
            'user': 'upstream-release-monitoring',
            'password': ''}
bz = Bugzilla(**rpc_conf)
bugs = bz.query(query)
print(bugs)

Actual results:

Traceback (most recent call last):
  File "bugzilla_queries.py", line 18, in <module>
    bugs = bz.query(query)
  File "/usr/lib/python3.3/site-packages/bugzilla/base.py", line 991, in query
    r = self._query(query)
  File "/usr/lib/python3.3/site-packages/bugzilla/base.py", line 982, in _query
    return self._proxy.Bug.search(query)
  File "/usr/lib64/python3.3/xmlrpc/client.py", line 1090, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python3.3/xmlrpc/client.py", line 1419, in __request
    verbose=self.__verbose
  File "/usr/lib/python3.3/site-packages/bugzilla/base.py", line 191, in request
    return self._request_helper(url, request_body)
  File "/usr/lib/python3.3/site-packages/bugzilla/base.py", line 177, in _request_helper
    raise sys.exc_info()[1]
  File "/usr/lib/python3.3/site-packages/bugzilla/base.py", line 169, in _request_helper
    return self.parse_response(response)
  File "/usr/lib/python3.3/site-packages/bugzilla/base.py", line 144, in parse_response
    return unmarshaller.close()
  File "/usr/lib64/python3.3/xmlrpc/client.py", line 657, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault Client: "Content-Type must be 'text/xml,' 'multipart/*,' 'application/soap+xml,' 'or 'application/dime' instead of 'application/x-www-form-urlencoded,text/xml'">


Expected results:

List of bugs

Additional info:

I am attaching the patch that solves the issue.

Comment 1 Cole Robinson 2014-06-05 17:59:05 UTC
Thanks for the report, pushed your patch now

Annoyingly our test infrastructure should have caught this, but it was pulling python-requests from pip which is much newer than the F20 version and seems to not require this change. I fixed our test infrastructure to prefer system packages instead.