Bug 1104197 - Cant query bugzilla with python3
Summary: Cant query bugzilla with python3
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: python-bugzilla
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Cole Robinson
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-03 13:28 UTC by Josef Stribny
Modified: 2016-01-04 05:52 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-05 17:59:05 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Patch that solves the issue by making a string out of request_body for POST (803 bytes, patch)
2014-06-03 13:28 UTC, Josef Stribny
no flags Details | Diff

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.


Note You need to log in before you can comment on or make changes to this bug.