fix xmlrpc encoding error
This commit is contained in:
parent
5216c54572
commit
ca86a8fa78
2 changed files with 9 additions and 1 deletions
|
|
@ -2400,6 +2400,14 @@ class ClientSession(object):
|
|||
else:
|
||||
handler = self.baseurl
|
||||
request = dumps(args, name, allow_none=1)
|
||||
try:
|
||||
request.encode('latin-1')
|
||||
except (UnicodeEncodeError, UnicodeDecodeError):
|
||||
# py2 string throws UnicodeDecodeError
|
||||
# py3 string throws UnicodeEncodeError
|
||||
# if string is not converted to UTF, requests will raise an error
|
||||
# on identical check before sending data
|
||||
request = request.encode('utf-8')
|
||||
headers = [
|
||||
# connection class handles Host
|
||||
('User-Agent', 'koji/1'),
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ def dumps(params, methodname=None, methodresponse=None, encoding=None,
|
|||
if isinstance(params, Fault):
|
||||
methodresponse = 1
|
||||
elif not isinstance(params, tuple):
|
||||
raise TypeError('params must be a tuple of Fault instance')
|
||||
raise TypeError('params must be a tuple or Fault instance')
|
||||
elif methodresponse and len(params) != 1:
|
||||
raise ValueError('response tuple must be a singleton')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue