From b305436d505596d433389cdf600178a69e90ec31 Mon Sep 17 00:00:00 2001 From: tzing_t Date: Thu, 24 Aug 2023 02:03:26 +0000 Subject: [PATCH] fix conflict with suds-jurko --- python-suds-jurko.spec | 8 +- suds-jurko.patch | 2418 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2424 insertions(+), 2 deletions(-) create mode 100644 suds-jurko.patch diff --git a/python-suds-jurko.spec b/python-suds-jurko.spec index 0647de6..72b028c 100644 --- a/python-suds-jurko.spec +++ b/python-suds-jurko.spec @@ -1,11 +1,12 @@ %global _empty_manifest_terminate_build 0 Name: python-suds-jurko Version: 0.6 -Release: 2 +Release: 3 Summary: Lightweight SOAP client (Jurko's fork) License: LGPL-3.0 and GPL-3.0 URL: http://bitbucket.org/jurko/suds Source0: https://files.pythonhosted.org/packages/d0/88/f3bed9b494e0dae26bd55e5f3d527b8244208125024727267e8109956a11/suds-jurko-0.6.zip +Patch001: suds-jurko.patch BuildArch: noarch %description Lightweight SOAP client (Jurko's fork) @@ -30,7 +31,7 @@ Provides: python3-suds-jurko-doc Lightweight SOAP client (Jurko's fork) %prep -%autosetup -n suds-jurko-%{version} +%autosetup -n suds-jurko-%{version} -p1 %build %py3_build @@ -71,6 +72,9 @@ mv %{buildroot}/doclist.lst . %{_docdir}/* %changelog +* Thu Aug 24 2023 zhengting - 0.6-3 +- DESC: fix conflict with suds-jurko + * Tue Aug 17 2021 liusheng - 0.6-2 - Add conflict with python3-suds2 package diff --git a/suds-jurko.patch b/suds-jurko.patch new file mode 100644 index 0000000..31eff34 --- /dev/null +++ b/suds-jurko.patch @@ -0,0 +1,2418 @@ +diff --git a/setup.py b/setup.py +index 12bc3af..29f6ba8 100644 +--- a/setup.py ++++ b/setup.py +@@ -91,16 +91,6 @@ if sys.version_info >= (2, 5): + # distutils.setup() 'obsoletes' parameter not introduced until Python 2.5. + extra_setup_params["obsoletes"] = ["suds"] + +-if sys.version_info >= (3, 0): +- extra_setup_params["use_2to3"] = True +- +- # Teach Python's urllib lib2to3 fixer that the old urllib2.__version__ +- # data member is now stored in the urllib.request module. +- import lib2to3.fixes.fix_urllib +- for x in lib2to3.fixes.fix_urllib.MAPPING["urllib2"]: +- if x[0] == "urllib.request": +- x[1].append("__version__") +- break; + + # Wrap long_description at 72 characters since PKG-INFO package distribution + # metadata file stores this text with an 8 space indentation. +diff --git a/suds/__init__.py b/suds/__init__.py +index 1f8a6d9..ccfbb70 100644 +--- a/suds/__init__.py ++++ b/suds/__init__.py +@@ -34,19 +34,19 @@ from version import __build__, __version__ + + class MethodNotFound(Exception): + def __init__(self, name): +- Exception.__init__(self, u"Method not found: '%s'" % name) ++ Exception.__init__(self, "Method not found: '%s'" % name) + + class PortNotFound(Exception): + def __init__(self, name): +- Exception.__init__(self, u"Port not found: '%s'" % name) ++ Exception.__init__(self, "Port not found: '%s'" % name) + + class ServiceNotFound(Exception): + def __init__(self, name): +- Exception.__init__(self, u"Service not found: '%s'" % name) ++ Exception.__init__(self, "Service not found: '%s'" % name) + + class TypeNotFound(Exception): + def __init__(self, name): +- Exception.__init__(self, u"Type not found: '%s'" % tostr(name)) ++ Exception.__init__(self, "Type not found: '%s'" % tostr(name)) + + class BuildError(Exception): + msg = """ +@@ -71,7 +71,7 @@ class SoapHeadersNotPermitted(Exception): + class WebFault(Exception): + def __init__(self, fault, document): + if hasattr(fault, 'faultstring'): +- Exception.__init__(self, u"Server raised fault: '%s'" % ++ Exception.__init__(self, "Server raised fault: '%s'" % + fault.faultstring) + self.fault = fault + self.document = document +@@ -104,7 +104,7 @@ def objid(obj): + + def tostr(object, encoding=None): + """ get a unicode safe string representation of an object """ +- if isinstance(object, basestring): ++ if isinstance(object, str): + if encoding is None: + return object + else: +@@ -112,7 +112,7 @@ def tostr(object, encoding=None): + if isinstance(object, tuple): + s = ['('] + for item in object: +- if isinstance(item, basestring): ++ if isinstance(item, str): + s.append(item) + else: + s.append(tostr(item)) +@@ -122,7 +122,7 @@ def tostr(object, encoding=None): + if isinstance(object, list): + s = ['['] + for item in object: +- if isinstance(item, basestring): ++ if isinstance(item, str): + s.append(item) + else: + s.append(tostr(item)) +@@ -132,12 +132,12 @@ def tostr(object, encoding=None): + if isinstance(object, dict): + s = ['{'] + for item in object.items(): +- if isinstance(item[0], basestring): ++ if isinstance(item[0], str): + s.append(item[0]) + else: + s.append(tostr(item[0])) + s.append(' = ') +- if isinstance(item[1], basestring): ++ if isinstance(item[1], str): + s.append(item[1]) + else: + s.append(tostr(item[1])) +@@ -145,7 +145,7 @@ def tostr(object, encoding=None): + s.append('}') + return ''.join(s) + try: +- return unicode(object) ++ return str(object) + except: + return str(object) + +@@ -155,7 +155,7 @@ def tostr(object, encoding=None): + # + + if sys.version_info < (3, 0): +- from cStringIO import StringIO as BytesIO ++ from io import StringIO as BytesIO + else: + from io import BytesIO + +@@ -165,7 +165,7 @@ class UnicodeMixin(object): + # For Python 3, __str__() and __unicode__() should be identical. + __str__ = lambda x: x.__unicode__() + else: +- __str__ = lambda x: unicode(x).encode('utf-8') ++ __str__ = lambda x: str(x).encode('utf-8') + + # Used instead of byte literals because they are not supported on Python + # versions prior to 2.6. +@@ -177,8 +177,8 @@ def byte_str(s='', encoding='utf-8', input_encoding='utf-8', errors='strict'): + strings encoded using the given input encoding. + + """ +- assert isinstance(s, basestring) +- if isinstance(s, unicode): ++ assert isinstance(s, str) ++ if isinstance(s, str): + return s.encode(encoding, errors) + if s and encoding != input_encoding: + return s.decode(input_encoding, errors).encode(encoding, errors) +diff --git a/suds/argparser.py b/suds/argparser.py +index 84ac026..ddb2198 100644 +--- a/suds/argparser.py ++++ b/suds/argparser.py +@@ -263,7 +263,7 @@ class _ArgParser: + if len(stack) == 1: + return stack[0], ancestry + previous = stack[0] +- for frame, n in zip(stack[1:], xrange(len(ancestry))): ++ for frame, n in zip(stack[1:], range(len(ancestry))): + if frame.id() is not ancestry[n]: + return previous, ancestry[n:] + previous = frame +diff --git a/suds/bindings/binding.py b/suds/bindings/binding.py +index 62f641c..17d7d19 100644 +--- a/suds/bindings/binding.py ++++ b/suds/bindings/binding.py +@@ -88,7 +88,7 @@ class Binding: + @return: A collection of parameter definitions + @rtype: [I{pdef},..] + """ +- raise Exception, 'not implemented' ++ raise Exception('not implemented') + + def get_message(self, method, args, kwargs): + """ +@@ -286,7 +286,7 @@ class Binding: + @return: The XML content for the + @rtype: [L{Element},..] + """ +- raise Exception, 'not implemented' ++ raise Exception('not implemented') + + def headercontent(self, method): + """ +@@ -339,7 +339,7 @@ class Binding: + @return: The body content. + @rtype: [L{Element},...] + """ +- raise Exception, 'not implemented' ++ raise Exception('not implemented') + + def body(self, content): + """ +diff --git a/suds/builder.py b/suds/builder.py +index 8ebfb38..42eba0b 100644 +--- a/suds/builder.py ++++ b/suds/builder.py +@@ -34,7 +34,7 @@ class Builder: + + def build(self, name): + """ build a an object for the specified typename as defined in the schema """ +- if isinstance(name, basestring): ++ if isinstance(name, str): + type = self.resolver.find(name) + if type is None: + raise TypeNotFound(name) +diff --git a/suds/cache.py b/suds/cache.py +index e156d19..1316609 100644 +--- a/suds/cache.py ++++ b/suds/cache.py +@@ -28,7 +28,7 @@ from datetime import timedelta + import os + from tempfile import gettempdir as tmp + try: +- import cPickle as pickle ++ import pickle + except Exception: + import pickle + +diff --git a/suds/client.py b/suds/client.py +index d7fda60..d506ebd 100644 +--- a/suds/client.py ++++ b/suds/client.py +@@ -39,10 +39,10 @@ from suds.umx.basic import Basic as UmxBasic + from suds.wsdl import Definitions + import sudsobject + +-from cookielib import CookieJar ++from http.cookiejar import CookieJar + from copy import deepcopy +-import httplib +-from urlparse import urlparse ++import http.client ++from urllib.parse import urlparse + + from logging import getLogger + log = getLogger(__name__) +@@ -181,7 +181,7 @@ class Client(UnicodeMixin): + if ( suds.__build__ ): + s.append(' build: %s' % suds.__build__) + for sd in self.sd: +- s.append('\n\n%s' % unicode(sd)) ++ s.append('\n\n%s' % str(sd)) + return ''.join(s) + + +@@ -223,7 +223,7 @@ class Factory: + else: + try: + result = self.builder.build(type) +- except Exception, e: ++ except Exception as e: + log.error("create '%s' failed", name, exc_info=True) + raise BuildError(name, e) + timer.stop() +@@ -312,20 +312,20 @@ class ServiceSelector: + """ + service = None + if not len(self.__services): +- raise Exception, 'No services defined' ++ raise Exception('No services defined') + if isinstance(name, int): + try: + service = self.__services[name] + name = service.name + except IndexError: +- raise ServiceNotFound, 'at [%d]' % name ++ raise ServiceNotFound('at [%d]' % name) + else: + for s in self.__services: + if name == s.name: + service = s + break + if service is None: +- raise ServiceNotFound, name ++ raise ServiceNotFound(name) + return PortSelector(self.__client, service.ports, name) + + def __ds(self): +@@ -413,13 +413,13 @@ class PortSelector: + """ + port = None + if not len(self.__ports): +- raise Exception, 'No ports defined: %s' % self.__qn ++ raise Exception('No ports defined: %s' % self.__qn) + if isinstance(name, int): + qn = '%s[%d]' % (self.__qn, name) + try: + port = self.__ports[name] + except IndexError: +- raise PortNotFound, qn ++ raise PortNotFound(qn) + else: + qn = '.'.join((self.__qn, name)) + for p in self.__ports: +@@ -427,7 +427,7 @@ class PortSelector: + port = p + break + if port is None: +- raise PortNotFound, qn ++ raise PortNotFound(qn) + qn = '.'.join((self.__qn, port.name)) + return MethodSelector(self.__client, port.methods, qn) + +@@ -488,7 +488,7 @@ class MethodSelector: + m = self.__methods.get(name) + if m is None: + qn = '.'.join((self.__qn, name)) +- raise MethodNotFound, qn ++ raise MethodNotFound(qn) + return Method(self.__client, m) + + +@@ -519,10 +519,10 @@ class Method: + client = clientclass(self.client, self.method) + try: + return client.invoke(args, kwargs) +- except WebFault, e: ++ except WebFault as e: + if self.faults(): + raise +- return (httplib.INTERNAL_SERVER_ERROR, e) ++ return (http.client.INTERNAL_SERVER_ERROR, e) + + def faults(self): + """ get faults option """ +@@ -613,7 +613,7 @@ class SoapClient: + reply = self.options.transport.send(request) + timer.stop() + metrics.log.debug('waited %s on server reply', timer) +- except TransportError, e: ++ except TransportError as e: + content = e.fp and e.fp.read() or '' + return self.process_reply(reply=content, status=e.httpcode, + description=tostr(e), original_soapenv=original_soapenv) +@@ -623,12 +623,12 @@ class SoapClient: + def process_reply(self, reply, status=None, description=None, + original_soapenv=None): + if status is None: +- status = httplib.OK +- if status in (httplib.ACCEPTED, httplib.NO_CONTENT): ++ status = http.client.OK ++ if status in (http.client.ACCEPTED, http.client.NO_CONTENT): + return + failed = True + try: +- if status == httplib.OK: ++ if status == http.client.OK: + log.debug('HTTP succeeded:\n%s', reply) + else: + log.debug('HTTP failed - %d - %s:\n%s', status, description, +@@ -636,7 +636,7 @@ class SoapClient: + + # (todo) + # Consider whether and how to allow plugins to handle error, +- # httplib.ACCEPTED & httplib.NO_CONTENT replies as well as ++ # http.client.ACCEPTED & http.client.NO_CONTENT replies as well as + # successful ones. + # (todo) (27.03.2013.) (Jurko) + plugins = PluginContainer(self.options.plugins) +@@ -657,19 +657,19 @@ class SoapClient: + # An INSTANCE MUST use a "500 Internal Server Error" HTTP status + # code if the response message is a SOAP Fault. + replyroot = None +- if status in (httplib.OK, httplib.INTERNAL_SERVER_ERROR): ++ if status in (http.client.OK, http.client.INTERNAL_SERVER_ERROR): + replyroot = _parse(reply) + plugins.message.parsed(reply=replyroot) + fault = self.get_fault(replyroot) + if fault: +- if status != httplib.INTERNAL_SERVER_ERROR: ++ if status != http.client.INTERNAL_SERVER_ERROR: + log.warn("Web service reported a SOAP processing " + "fault using an unexpected HTTP status code %d. " + "Reporting as an internal server error.", status) + if self.options.faults: + raise WebFault(fault, replyroot) +- return (httplib.INTERNAL_SERVER_ERROR, fault) +- if status != httplib.OK: ++ return (http.client.INTERNAL_SERVER_ERROR, fault) ++ if status != http.client.OK: + if self.options.faults: + # (todo) + # Use a more specific exception class here. +@@ -688,7 +688,7 @@ class SoapClient: + failed = False + if self.options.faults: + return result +- return (httplib.OK, result) ++ return (http.client.OK, result) + finally: + if failed and original_soapenv: + log.error(original_soapenv) +@@ -717,7 +717,7 @@ class SoapClient: + @rtype: dict + """ + action = self.method.soap.action +- if isinstance(action, unicode): ++ if isinstance(action, str): + action = action.encode('utf-8') + stock = {'Content-Type':'text/xml; charset=utf-8', 'SOAPAction':action} + result = dict(stock, **self.options.headers) +@@ -742,7 +742,7 @@ class SimClient(SoapClient): + @classmethod + def simulation(cls, kwargs): + """ get whether loopback has been specified in the I{kwargs}. """ +- return kwargs.has_key(SimClient.injkey) ++ return SimClient.injkey in kwargs + + def invoke(self, args, kwargs): + """ +diff --git a/suds/mx/__init__.py b/suds/mx/__init__.py +index 719e52d..561ce9b 100644 +--- a/suds/mx/__init__.py ++++ b/suds/mx/__init__.py +@@ -52,8 +52,8 @@ class Content(Object): + v = None + setattr(self, name, v) + else: +- raise AttributeError, \ +- 'Content has no attribute %s' % name ++ raise AttributeError \ ++ ('Content has no attribute %s' % name) + else: + v = self.__dict__[name] + return v +diff --git a/suds/mx/encoded.py b/suds/mx/encoded.py +index ec09536..1f1181a 100644 +--- a/suds/mx/encoded.py ++++ b/suds/mx/encoded.py +@@ -107,7 +107,7 @@ class Encoded(Literal): + query = TypeQuery(aty) + ref = query.execute(self.schema) + if ref is None: +- raise TypeNotFound(qref) ++ raise TypeNotFound(ref) + for x in content.value: + if isinstance(x, (list, tuple)): + array.item.append(x) +diff --git a/suds/mx/literal.py b/suds/mx/literal.py +index 4b3480f..1498665 100644 +--- a/suds/mx/literal.py ++++ b/suds/mx/literal.py +@@ -131,9 +131,9 @@ class Typed(Core): + if current == content.type: + self.resolver.pop() + else: +- raise Exception, \ +- 'content (end) mismatch: top=(%s) cont=(%s)' % \ +- (current, content) ++ raise Exception \ ++ ('content (end) mismatch: top=(%s) cont=(%s)' % \ ++ (current, content)) + + def node(self, content): + # +diff --git a/suds/mx/typer.py b/suds/mx/typer.py +index dc16fa5..0378b98 100644 +--- a/suds/mx/typer.py ++++ b/suds/mx/typer.py +@@ -33,10 +33,10 @@ class Typer: + + types = { + int : ('int', NS.xsdns), +- long : ('long', NS.xsdns), ++ int : ('long', NS.xsdns), + float : ('float', NS.xsdns), + str : ('string', NS.xsdns), +- unicode : ('string', NS.xsdns), ++ str : ('string', NS.xsdns), + Text : ('string', NS.xsdns), + bool : ('boolean', NS.xsdns), + } +diff --git a/suds/options.py b/suds/options.py +index 2b2d489..8be480f 100644 +--- a/suds/options.py ++++ b/suds/options.py +@@ -132,9 +132,9 @@ class Options(Skin): + Definition('extraArgumentErrors', bool, True), + Definition('faults', bool, True), + Definition('transport', Transport, None, TpLinker()), +- Definition('service', (int, basestring), None), +- Definition('port', (int, basestring), None), +- Definition('location', basestring, None), ++ Definition('service', (int, str), None), ++ Definition('port', (int, str), None), ++ Definition('location', str, None), + Definition('soapheaders', (), ()), + Definition('wsse', Security, None), + Definition('doctor', Doctor, None), +diff --git a/suds/plugin.py b/suds/plugin.py +index 3579f5c..f4afdf0 100644 +--- a/suds/plugin.py ++++ b/suds/plugin.py +@@ -205,7 +205,7 @@ class PluginContainer: + plugins.append(p) + return PluginDomain(ctx, plugins) + else: +- raise Exception, 'plugin domain (%s), invalid' % name ++ raise Exception('plugin domain (%s), invalid' % name) + + + class PluginDomain: +@@ -252,6 +252,6 @@ class Method: + method = getattr(plugin, self.name, None) + if method and callable(method): + method(ctx) +- except Exception, pe: ++ except Exception as pe: + log.exception(pe) + return ctx +diff --git a/suds/properties.py b/suds/properties.py +index 5907d94..43afb3c 100644 +--- a/suds/properties.py ++++ b/suds/properties.py +@@ -67,23 +67,23 @@ class Link(object): + """ + if pA in pB.links or \ + pB in pA.links: +- raise Exception, 'Already linked' ++ raise Exception('Already linked') + dA = pA.domains() + dB = pB.domains() + for d in dA: + if d in dB: +- raise Exception, 'Duplicate domain "%s" found' % d ++ raise Exception('Duplicate domain "%s" found' % d) + for d in dB: + if d in dA: +- raise Exception, 'Duplicate domain "%s" found' % d ++ raise Exception('Duplicate domain "%s" found' % d) + kA = pA.keys() + kB = pB.keys() + for k in kA: + if k in kB: +- raise Exception, 'Duplicate key %s found' % k ++ raise Exception('Duplicate key %s found' % k) + for k in kB: + if k in kA: +- raise Exception, 'Duplicate key %s found' % k ++ raise Exception('Duplicate key %s found' % k) + return self + + def teardown(self): +@@ -177,7 +177,7 @@ class Definition: + if len(self.classes) and \ + not isinstance(value, self.classes): + msg = '"%s" must be: %s' % (self.name, self.classes) +- raise AttributeError,msg ++ raise AttributeError(msg) + + + def __repr__(self): +diff --git a/suds/sax/__init__.py b/suds/sax/__init__.py +index be13823..49df146 100644 +--- a/suds/sax/__init__.py ++++ b/suds/sax/__init__.py +@@ -45,7 +45,7 @@ def splitPrefix(name): + @return: A tuple containing the (2) parts of I{name} + @rtype: (I{prefix}, I{name}) + """ +- if isinstance(name, basestring) and ':' in name: ++ if isinstance(name, str) and ':' in name: + return tuple(name.split(':', 1)) + return None, name + +diff --git a/suds/sax/date.py b/suds/sax/date.py +index c5e5e93..871e38a 100644 +--- a/suds/sax/date.py ++++ b/suds/sax/date.py +@@ -65,7 +65,7 @@ class Date(UnicodeMixin): + self.value = value.date() + elif isinstance(value, datetime.date): + self.value = value +- elif isinstance(value, basestring): ++ elif isinstance(value, str): + self.value = self.__parse(value) + else: + raise ValueError("invalid type for Date(): %s" % type(value)) +@@ -115,7 +115,7 @@ class DateTime(UnicodeMixin): + """ + if isinstance(value, datetime.datetime): + self.value = value +- elif isinstance(value, basestring): ++ elif isinstance(value, str): + self.value = self.__parse(value) + else: + raise ValueError("invalid type for DateTime(): %s" % type(value)) +@@ -173,7 +173,7 @@ class Time(UnicodeMixin): + """ + if isinstance(value, datetime.time): + self.value = value +- elif isinstance(value, basestring): ++ elif isinstance(value, str): + self.value = self.__parse(value) + else: + raise ValueError("invalid type for Time(): %s" % type(value)) +diff --git a/suds/sax/document.py b/suds/sax/document.py +index 7a4a615..3b95aaf 100644 +--- a/suds/sax/document.py ++++ b/suds/sax/document.py +@@ -52,7 +52,7 @@ class Document: + the document root element. + @type node: (L{Element}|str|None) + """ +- if isinstance(node, basestring): ++ if isinstance(node, str): + self.__root = Element(node) + return + if isinstance(node, Element): +diff --git a/suds/sax/element.py b/suds/sax/element.py +index 084ea2b..b612de2 100644 +--- a/suds/sax/element.py ++++ b/suds/sax/element.py +@@ -730,7 +730,7 @@ class Element(UnicodeMixin): + result = [] + result.append('%s<%s' % (tab, self.qname())) + result.append(self.nsdeclarations()) +- for a in [unicode(a) for a in self.attributes]: ++ for a in [str(a) for a in self.attributes]: + result.append(' %s' % a) + if self.isempty(): + result.append('/>') +@@ -755,7 +755,7 @@ class Element(UnicodeMixin): + result = [] + result.append('<%s' % self.qname()) + result.append(self.nsdeclarations()) +- for a in [unicode(a) for a in self.attributes]: ++ for a in [str(a) for a in self.attributes]: + result.append(' %s' % a) + if self.isempty(): + result.append('/>') +@@ -884,13 +884,13 @@ class Element(UnicodeMixin): + return len(self.children) + + def __getitem__(self, index): +- if isinstance(index, basestring): ++ if isinstance(index, str): + return self.get(index) + if index < len(self.children): + return self.children[index] + + def __setitem__(self, index, value): +- if isinstance(index, basestring): ++ if isinstance(index, str): + self.set(index, value) + else: + if index < len(self.children) and isinstance(value, Element): +diff --git a/suds/sax/enc.py b/suds/sax/enc.py +index 8d3219c..c319fdf 100644 +--- a/suds/sax/enc.py ++++ b/suds/sax/enc.py +@@ -46,7 +46,7 @@ class Encoder: + @return: True if needs encoding. + @rtype: boolean + """ +- if isinstance(s, basestring): ++ if isinstance(s, str): + for c in self.special: + if c in s: + return True +@@ -60,7 +60,7 @@ class Encoder: + @return: The encoded string. + @rtype: str + """ +- if isinstance(s, basestring) and self.needsEncoding(s): ++ if isinstance(s, str) and self.needsEncoding(s): + for x in self.encodings: + s = re.sub(x[0], x[1], s) + return s +@@ -73,7 +73,7 @@ class Encoder: + @return: The decoded string. + @rtype: str + """ +- if isinstance(s, basestring) and '&' in s: ++ if isinstance(s, str) and '&' in s: + for x in self.decodings: + s = s.replace(x[0], x[1]) + return s +diff --git a/suds/sax/parser.py b/suds/sax/parser.py +index a82583a..907735d 100644 +--- a/suds/sax/parser.py ++++ b/suds/sax/parser.py +@@ -47,10 +47,10 @@ class Handler(ContentHandler): + + def startElement(self, name, attrs): + top = self.top() +- node = Element(unicode(name)) ++ node = Element(str(name)) + for a in attrs.getNames(): +- n = unicode(a) +- v = unicode(attrs.getValue(a)) ++ n = str(a) ++ v = str(attrs.getValue(a)) + attribute = Attribute(n,v) + if self.mapPrefix(node, attribute): + continue +@@ -63,16 +63,16 @@ class Handler(ContentHandler): + skip = False + if attribute.name == 'xmlns': + if len(attribute.value): +- node.expns = unicode(attribute.value) ++ node.expns = str(attribute.value) + skip = True + elif attribute.prefix == 'xmlns': + prefix = attribute.name +- node.nsprefixes[prefix] = unicode(attribute.value) ++ node.nsprefixes[prefix] = str(attribute.value) + skip = True + return skip + + def endElement(self, name): +- name = unicode(name) ++ name = str(name) + current = self.top() + if len(current.charbuffer): + current.text = Text(u''.join(current.charbuffer)) +@@ -85,7 +85,7 @@ class Handler(ContentHandler): + raise Exception('malformed document') + + def characters(self, content): +- text = unicode(content) ++ text = str(content) + node = self.top() + node.charbuffer.append(text) + +diff --git a/suds/sax/text.py b/suds/sax/text.py +index 985386e..08dc093 100644 +--- a/suds/sax/text.py ++++ b/suds/sax/text.py +@@ -22,7 +22,7 @@ from suds import * + from suds.sax import * + + +-class Text(unicode): ++class Text(str): + """ + An XML text object used to represent text content. + @ivar lang: The (optional) language flag. +diff --git a/suds/servicedefinition.py b/suds/servicedefinition.py +index 6b0e72f..c5cd2ec 100644 +--- a/suds/servicedefinition.py ++++ b/suds/servicedefinition.py +@@ -235,6 +235,6 @@ class ServiceDefinition(UnicodeMixin): + def __unicode__(self): + try: + return self.description() +- except Exception, e: ++ except Exception as e: + log.exception(e) + return tostr(e) +diff --git a/suds/serviceproxy.py b/suds/serviceproxy.py +index 278c189..05708aa 100644 +--- a/suds/serviceproxy.py ++++ b/suds/serviceproxy.py +@@ -70,7 +70,7 @@ class ServiceProxy(UnicodeMixin): + return self.__client__.factory.create(name) + + def __unicode__(self): +- return unicode(self.__client__) ++ return str(self.__client__) + + def __getattr__(self, name): + builtin = name.startswith('__') and name.endswith('__') +diff --git a/suds/store.py b/suds/store.py +index e5931aa..3b80502 100644 +--- a/suds/store.py ++++ b/suds/store.py +@@ -566,7 +566,7 @@ class DocumentStore: + protocol, location = self.__split(url) + content = self.__find(location) + if protocol == 'suds' and content is None: +- raise Exception, 'location "%s" not in document store' % location ++ raise Exception('location "%s" not in document store' % location) + return content + + def __find(self, location): +diff --git a/suds/sudsobject.py b/suds/sudsobject.py +index f96d419..0c0ac40 100644 +--- a/suds/sudsobject.py ++++ b/suds/sudsobject.py +@@ -146,7 +146,7 @@ class Object(UnicodeMixin): + self.__keylist__.remove(name) + except: + cls = self.__class__.__name__ +- raise AttributeError, "%s has no attribute '%s'" % (cls, name) ++ raise AttributeError("%s has no attribute '%s'" % (cls, name)) + + def __getitem__(self, name): + if isinstance(name, int): +@@ -271,7 +271,7 @@ class Printer: + if len(object) == 0: + return '' + return self.print_collection(object, h, n+2) +- if isinstance(object, basestring): ++ if isinstance(object, str): + return '"%s"' % tostr(object) + return '%s' % tostr(object) + +diff --git a/suds/transport/http.py b/suds/transport/http.py +index e3d042b..ba57149 100644 +--- a/suds/transport/http.py ++++ b/suds/transport/http.py +@@ -22,12 +22,12 @@ from suds.properties import Unskin + from suds.transport import * + + import base64 +-from cookielib import CookieJar +-import httplib ++from http.cookiejar import CookieJar ++import http.client + import socket + import sys +-import urllib2 +-from urlparse import urlparse ++import urllib.request, urllib.error, urllib.parse ++from urllib.parse import urlparse + + from logging import getLogger + log = getLogger(__name__) +@@ -62,10 +62,10 @@ class HttpTransport(Transport): + try: + url = self.__get_request_url(request) + log.debug('opening (%s)', url) +- u2request = urllib2.Request(url) ++ u2request = urllib.request.Request(url) + self.proxy = self.options.proxy + return self.u2open(u2request) +- except urllib2.HTTPError, e: ++ except urllib.error.HTTPError as e: + raise TransportError(str(e), e.code, e.fp) + + def send(self, request): +@@ -74,7 +74,7 @@ class HttpTransport(Transport): + msg = request.message + headers = request.headers + try: +- u2request = urllib2.Request(url, msg, headers) ++ u2request = urllib.request.Request(url, msg, headers) + self.addcookies(u2request) + self.proxy = self.options.proxy + request.headers.update(u2request.headers) +@@ -85,10 +85,10 @@ class HttpTransport(Transport): + headers = fp.headers.dict + else: + headers = fp.headers +- result = Reply(httplib.OK, headers, fp.read()) ++ result = Reply(http.client.OK, headers, fp.read()) + log.debug('received:\n%s', result) +- except urllib2.HTTPError, e: +- if e.code in (httplib.ACCEPTED, httplib.NO_CONTENT): ++ except urllib.error.HTTPError as e: ++ if e.code in (http.client.ACCEPTED, http.client.NO_CONTENT): + result = None + else: + raise TransportError(e.msg, e.code, e.fp) +@@ -140,7 +140,7 @@ class HttpTransport(Transport): + + """ + if self.urlopener is None: +- return urllib2.build_opener(*self.u2handlers()) ++ return urllib.request.build_opener(*self.u2handlers()) + return self.urlopener + + def u2handlers(self): +@@ -152,7 +152,7 @@ class HttpTransport(Transport): + + """ + handlers = [] +- handlers.append(urllib2.ProxyHandler(self.proxy)) ++ handlers.append(urllib.request.ProxyHandler(self.proxy)) + return handlers + + def u2ver(self): +@@ -163,9 +163,9 @@ class HttpTransport(Transport): + @rtype: float + """ + try: +- part = urllib2.__version__.split('.', 1) ++ part = urllib.request.__version__.split('.', 1) + return float('.'.join(part)) +- except Exception, e: ++ except Exception as e: + log.exception(e) + return 0 + +diff --git a/suds/transport/https.py b/suds/transport/https.py +index cdff55a..f1f9051 100644 +--- a/suds/transport/https.py ++++ b/suds/transport/https.py +@@ -21,7 +21,7 @@ Contains classes for authenticated HTTP transport implementations. + from suds.transport import * + from suds.transport.http import HttpTransport + +-import urllib2 ++import urllib.request, urllib.error, urllib.parse + + + class HttpAuthenticated(HttpTransport): +@@ -55,7 +55,7 @@ class HttpAuthenticated(HttpTransport): + + """ + HttpTransport.__init__(self, **kwargs) +- self.pm = urllib2.HTTPPasswordMgrWithDefaultRealm() ++ self.pm = urllib.request.HTTPPasswordMgrWithDefaultRealm() + + def open(self, request): + self.addcredentials(request) +@@ -77,7 +77,7 @@ class HttpAuthenticated(HttpTransport): + + def u2handlers(self): + handlers = HttpTransport.u2handlers(self) +- handlers.append(urllib2.HTTPBasicAuthHandler(self.pm)) ++ handlers.append(urllib.request.HTTPBasicAuthHandler(self.pm)) + return handlers + + +diff --git a/suds/transport/options.py b/suds/transport/options.py +index f6a071e..ccaee82 100644 +--- a/suds/transport/options.py ++++ b/suds/transport/options.py +@@ -53,6 +53,6 @@ class Options(Skin): + Definition('proxy', dict, {}), + Definition('timeout', (int,float), 90), + Definition('headers', dict, {}), +- Definition('username', basestring, None), +- Definition('password', basestring, None)] ++ Definition('username', str, None), ++ Definition('password', str, None)] + Skin.__init__(self, domain, definitions, kwargs) +diff --git a/suds/umx/__init__.py b/suds/umx/__init__.py +index ca65cad..229d2e2 100644 +--- a/suds/umx/__init__.py ++++ b/suds/umx/__init__.py +@@ -49,8 +49,8 @@ class Content(Object): + v = None + setattr(self, name, v) + else: +- raise AttributeError, \ +- 'Content has no attribute %s' % name ++ raise AttributeError \ ++ ('Content has no attribute %s' % name) + else: + v = self.__dict__[name] + return v +diff --git a/suds/umx/core.py b/suds/umx/core.py +index 4db8eaa..a819245 100644 +--- a/suds/umx/core.py ++++ b/suds/umx/core.py +@@ -95,7 +95,7 @@ class Core: + return None + else: + return Text('', lang=lang) +- if isinstance(content.text, basestring): ++ if isinstance(content.text, str): + return Text(content.text, lang=lang) + else: + return content.text +diff --git a/suds/wsdl.py b/suds/wsdl.py +index 987dbc3..814eae5 100644 +--- a/suds/wsdl.py ++++ b/suds/wsdl.py +@@ -32,7 +32,7 @@ from suds.reader import DocumentReader + + import re + import soaparray +-from urlparse import urljoin ++from urllib.parse import urljoin + + from logging import getLogger + log = getLogger(__name__) +@@ -505,7 +505,7 @@ class PortType(NamedObject): + qref = qualify(f.message, self.root, definitions.tns) + msg = definitions.messages.get(qref) + if msg is None: +- raise Exception, "msg '%s', not-found" % f.message ++ raise Exception("msg '%s', not-found" % f.message) + f.message = msg + + def operation(self, name): +@@ -519,7 +519,7 @@ class PortType(NamedObject): + """ + try: + return self.operations[name] +- except Exception, e: ++ except Exception as e: + raise MethodNotFound(name) + + def __gt__(self, other): +@@ -683,8 +683,8 @@ class Binding(NamedObject): + """ + ptop = self.type.operation(op.name) + if ptop is None: +- raise Exception, \ +- "operation '%s' not defined in portType" % op.name ++ raise Exception \ ++ ("operation '%s' not defined in portType" % op.name) + soap = op.soap + parts = soap.input.body.parts + if len(parts): +@@ -720,15 +720,15 @@ class Binding(NamedObject): + ref = qualify(mn, self.root, definitions.tns) + message = definitions.messages.get(ref) + if message is None: +- raise Exception, "message'%s', not-found" % mn ++ raise Exception("message'%s', not-found" % mn) + pn = header.part + for p in message.parts: + if p.name == pn: + header.part = p + break + if pn == header.part: +- raise Exception, \ +- "message '%s' has not part named '%s'" % (ref, pn) ++ raise Exception \ ++ ("message '%s' has not part named '%s'" % (ref, pn)) + + def resolvefaults(self, definitions, op): + """ +@@ -741,8 +741,8 @@ class Binding(NamedObject): + """ + ptop = self.type.operation(op.name) + if ptop is None: +- raise Exception, \ +- "operation '%s' not defined in portType" % op.name ++ raise Exception \ ++ ("operation '%s' not defined in portType" % op.name) + soap = op.soap + for fault in soap.faults: + for f in ptop.faults: +@@ -751,8 +751,8 @@ class Binding(NamedObject): + continue + if hasattr(fault, 'parts'): + continue +- raise Exception, \ +- "fault '%s' not defined in portType '%s'" % (fault.name, self.type.name) ++ raise Exception \ ++ ("fault '%s' not defined in portType '%s'" % (fault.name, self.type.name)) + + def operation(self, name): + """ +diff --git a/suds/xsd/__init__.py b/suds/xsd/__init__.py +index c5d8015..39c2b1d 100644 +--- a/suds/xsd/__init__.py ++++ b/suds/xsd/__init__.py +@@ -59,8 +59,8 @@ def isqref(object): + return (\ + isinstance(object, tuple) and \ + len(object) == 2 and \ +- isinstance(object[0], basestring) and \ +- isinstance(object[1], basestring)) ++ isinstance(object[0], str) and \ ++ isinstance(object[1], str)) + + + class Filter: +diff --git a/suds/xsd/deplist.py b/suds/xsd/deplist.py +index b813f80..540afb3 100644 +--- a/suds/xsd/deplist.py ++++ b/suds/xsd/deplist.py +@@ -137,4 +137,4 @@ if __name__ == '__main__': + x = ('x', ()) + L = DepList() + L.add(c, e, d, b, f, a, x) +- print [x[0] for x in L.sort()] ++ print([x[0] for x in L.sort()]) +diff --git a/suds/xsd/query.py b/suds/xsd/query.py +index 8f2266b..4092325 100644 +--- a/suds/xsd/query.py ++++ b/suds/xsd/query.py +@@ -54,7 +54,7 @@ class Query(Object): + @return: The item matching the search criteria. + @rtype: L{sxbase.SchemaObject} + """ +- raise Exception, 'not-implemented by subclass' ++ raise Exception('not-implemented by subclass') + + def filter(self, result): + """ +diff --git a/suds/xsd/sxbase.py b/suds/xsd/sxbase.py +index 1ceb823..8ef7ffd 100644 +--- a/suds/xsd/sxbase.py ++++ b/suds/xsd/sxbase.py +@@ -463,7 +463,7 @@ class SchemaObject(UnicodeMixin): + return () + + def __unicode__(self): +- return unicode(self.str()) ++ return str(self.str()) + + def __repr__(self): + s = [] +diff --git a/suds/xsd/sxbasic.py b/suds/xsd/sxbasic.py +index f605088..931abac 100644 +--- a/suds/xsd/sxbasic.py ++++ b/suds/xsd/sxbasic.py +@@ -26,7 +26,7 @@ from suds.xsd.query import * + from suds.sax import Namespace + from suds.transport import TransportError + from suds.reader import DocumentReader +-from urlparse import urljoin ++from urllib.parse import urljoin + + from logging import getLogger + log = getLogger(__name__) +@@ -667,7 +667,7 @@ class Include(SchemaObject): + root.set(TNS, tns) + else: + if self.schema.tns[1] != tns: +- raise Exception, '%s mismatch' % TNS ++ raise Exception('%s mismatch' % TNS) + + + def description(self): +diff --git a/suds/xsd/sxbuiltin.py b/suds/xsd/sxbuiltin.py +index 3d2c3dd..c22d31c 100644 +--- a/suds/xsd/sxbuiltin.py ++++ b/suds/xsd/sxbuiltin.py +@@ -62,7 +62,7 @@ class XBoolean(XBuiltin): + @staticmethod + def translate(value, topython=True): + if topython: +- if isinstance(value, basestring): ++ if isinstance(value, str): + return XBoolean.translation[0].get(value) + else: + if isinstance(value, (bool, int)): +@@ -78,7 +78,7 @@ class XInteger(XBuiltin): + @staticmethod + def translate(value, topython=True): + if topython: +- if isinstance(value, basestring) and len(value): ++ if isinstance(value, str) and len(value): + return int(value) + else: + if isinstance(value, int): +@@ -94,10 +94,10 @@ class XLong(XBuiltin): + @staticmethod + def translate(value, topython=True): + if topython: +- if isinstance(value, basestring) and len(value): +- return long(value) ++ if isinstance(value, str) and len(value): ++ return int(value) + else: +- if isinstance(value, (int, long)): ++ if isinstance(value, (int, int)): + return str(value) + return value + +@@ -110,7 +110,7 @@ class XFloat(XBuiltin): + @staticmethod + def translate(value, topython=True): + if topython: +- if isinstance(value, basestring) and len(value): ++ if isinstance(value, str) and len(value): + return float(value) + else: + if isinstance(value, float): +@@ -126,7 +126,7 @@ class XDate(XBuiltin): + @staticmethod + def translate(value, topython=True): + if topython: +- if isinstance(value, basestring) and len(value): ++ if isinstance(value, str) and len(value): + return Date(value).value + else: + if isinstance(value, dt.date): +@@ -142,7 +142,7 @@ class XTime(XBuiltin): + @staticmethod + def translate(value, topython=True): + if topython: +- if isinstance(value, basestring) and len(value): ++ if isinstance(value, str) and len(value): + return Time(value).value + else: + if isinstance(value, dt.time): +@@ -158,7 +158,7 @@ class XDateTime(XBuiltin): + @staticmethod + def translate(value, topython=True): + if topython: +- if isinstance(value, basestring) and len(value): ++ if isinstance(value, str) and len(value): + return DateTime(value).value + else: + if isinstance(value, dt.datetime): +diff --git a/tests/external/axis1.py b/tests/external/axis1.py +index 4c74c30..53eeb1d 100644 +--- a/tests/external/axis1.py ++++ b/tests/external/axis1.py +@@ -36,34 +36,34 @@ credentials = dict(username='jortel', password='abc123') + class MyInitPlugin(InitPlugin): + + def initialized(self, context): +- print 'PLUGIN (init): initialized: ctx=%s' % context.__dict__ ++ print('PLUGIN (init): initialized: ctx=%s' % context.__dict__) + + + class MyDocumentPlugin(DocumentPlugin): + + def loaded(self, context): +- print 'PLUGIN (document): loaded: ctx=%s' % context.__dict__ ++ print('PLUGIN (document): loaded: ctx=%s' % context.__dict__) + + def parsed(self, context): +- print 'PLUGIN (document): parsed: ctx=%s' % context.__dict__ ++ print('PLUGIN (document): parsed: ctx=%s' % context.__dict__) + + + class MyMessagePlugin(MessagePlugin): + + def marshalled(self, context): +- print 'PLUGIN (message): marshalled: ctx=%s' % context.__dict__ ++ print('PLUGIN (message): marshalled: ctx=%s' % context.__dict__) + + def sending(self, context): +- print 'PLUGIN (message): sending: ctx=%s' % context.__dict__ ++ print('PLUGIN (message): sending: ctx=%s' % context.__dict__) + + def received(self, context): +- print 'PLUGIN (message): received: ctx=%s' % context.__dict__ ++ print('PLUGIN (message): received: ctx=%s' % context.__dict__) + + def parsed(self, context): +- print 'PLUGIN (message): parsed: ctx=%s' % context.__dict__ ++ print('PLUGIN (message): parsed: ctx=%s' % context.__dict__) + + def unmarshalled(self, context): +- print 'PLUGIN: (massage): unmarshalled: ctx=%s' % context.__dict__ ++ print('PLUGIN: (massage): unmarshalled: ctx=%s' % context.__dict__) + + + myplugins = ( +@@ -75,27 +75,27 @@ myplugins = ( + + def start(url): + global errors +- print '\n________________________________________________________________\n' +- print 'Test @ ( %s )\nerrors = %d\n' % (url, errors) ++ print('\n________________________________________________________________\n') ++ print('Test @ ( %s )\nerrors = %d\n' % (url, errors)) + + try: + url = 'http://localhost:8081/axis/services/basic-rpc-encoded?wsdl' + start(url) + t = HttpAuthenticated(**credentials) + client = Client(url, transport=t, cache=None, plugins=myplugins) +- print client ++ print(client) + # + # create a name object using the wsdl + # +- print 'create name' ++ print('create name') + name = client.factory.create('ns0:Name') +- name.first = u'jeff'+unichr(1234) ++ name.first = 'jeff'+chr(1234) + name.last = 'ortel' +- print name ++ print(name) + # + # create a phone object using the wsdl + # +- print 'create phone' ++ print('create phone') + phoneA = client.factory.create('ns0:Phone') + phoneA.npa = 410 + phoneA.nxx = 555 +@@ -119,18 +119,18 @@ try: + # create a person object using the wsdl + # + person = client.factory.create('ns0:Person') +- print '{empty} person=\n%s' % person ++ print('{empty} person=\n%s' % person) + person.name = name + person.age = 43 + person.phone = [phoneA,phoneB,phoneC] + person.pets = [dog] +- print 'person=\n%s' % person ++ print('person=\n%s' % person) + # + # add the person (using the webservice) + # +- print 'addPersion()' ++ print('addPersion()') + result = client.service.addPerson(person) +- print '\nreply(\n%s\n)\n' % str(result) ++ print('\nreply(\n%s\n)\n' % str(result)) + + # + # Async +@@ -159,22 +159,22 @@ try: + ap.age = person.age + ap.phone = person.phone + ap.pets = person.pets +- print 'AnotherPerson\n%s' % ap ++ print('AnotherPerson\n%s' % ap) + # + # update the person's name (using the webservice) + # +- print 'updatePersion()' ++ print('updatePersion()') + result = client.service.updatePerson(ap, newname) +- print '\nreply(\n%s\n)\n' % str(result) ++ print('\nreply(\n%s\n)\n' % str(result)) + result = client.service.updatePerson(ap, None) +- print '\nreply(\n%s\n)\n' % str(result) +-except WebFault, f: ++ print('\nreply(\n%s\n)\n' % str(result)) ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: +@@ -182,19 +182,19 @@ try: + start(url) + t = HttpAuthenticated(**credentials) + client = Client(url, transport=t, cache=None) +- print client ++ print(client) + # + # create a name object as dict + # +- print 'create name' ++ print('create name') + name = {} + name['first'] = 'Elmer' + name['last'] = 'Fudd' +- print name ++ print(name) + # + # create a phone as dict + # +- print 'create phone' ++ print('create phone') + phoneA = {} + phoneA['npa'] = 410 + phoneA['nxx'] = 555 +@@ -219,133 +219,133 @@ try: + # create a person as dict + # + person = {} +- print '{empty} person=\n%s' % person ++ print('{empty} person=\n%s' % person) + person['name'] = name + person['age'] = 43 + person['phone'] = [phoneA,phoneB, phoneC] + person['pets'] = [dog] +- print 'person=\n%s' % person ++ print('person=\n%s' % person) + # + # add the person (using the webservice) + # +- print 'addPersion()' ++ print('addPersion()') + result = client.service.addPerson(person) +- print '\nreply(\n%s\n)\n' % str(result) +-except WebFault, f: ++ print('\nreply(\n%s\n)\n' % str(result)) ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: +- print "echo(' this is cool ')" ++ print("echo(' this is cool ')") + result = client.service.echo('this is cool') +- print '\nreply( "%s" )\n' % str(result) +- print 'echo(None)' ++ print('\nreply( "%s" )\n' % str(result)) ++ print('echo(None)') + result = client.service.echo(None) +- print '\nreply( "%s" )\n' % str(result) +-except WebFault, f: ++ print('\nreply( "%s" )\n' % str(result)) ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: +- print 'hello()' ++ print('hello()') + result = client.service.hello() +- print '\nreply( %s )\n' % str(result) +-except WebFault, f: ++ print('\nreply( %s )\n' % str(result)) ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: +- print 'testVoid()' ++ print('testVoid()') + result = client.service.getVoid() +- print '\nreply( %s )\n' % str(result) +-except WebFault, f: ++ print('\nreply( %s )\n' % str(result)) ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: +- print '** new style arrays **' ++ print('** new style arrays **') + words = ['my', 'dog', 'likes', 'steak'] + result = client.service.printList(words) +- print '\nreply( %s )\n' % str(result) ++ print('\nreply( %s )\n' % str(result)) + +- print '** old style arrays **' ++ print('** old style arrays **') + array = client.factory.create('ArrayOf_xsd_string') +- print 'ArrayOf_xsd_string=\n%s' % array ++ print('ArrayOf_xsd_string=\n%s' % array) + array.item = ['my', 'dog', 'likes', 'steak'] + result = client.service.printList(array) +- print '\nreply( %s )\n' % str(result) +-except WebFault, f: ++ print('\nreply( %s )\n' % str(result)) ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: + s = 'hello' + for n in range(0, 3): +- print 'getList(%s, %d)' % (s, n) ++ print('getList(%s, %d)' % (s, n)) + result = client.service.getList(s, n) +- print '\nreply( %s )\n' % str(result) ++ print('\nreply( %s )\n' % str(result)) + assert ( isinstance(result, list) and len(result) == n ) +-except WebFault, f: ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: +- print 'testExceptions()' ++ print('testExceptions()') + result = client.service.throwException() +- print '\nreply( %s )\n' % tostr(result) ++ print('\nreply( %s )\n' % tostr(result)) + raise Exception('Fault expected and not raised') +-except WebFault, f: +- print f +- print f.fault +-except Exception, e: ++except WebFault as f: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: + url = 'http://localhost:8081/axis/services/basic-rpc-encoded?wsdl' + start(url) + client = Client(url, faults=False, **credentials) +- print 'testExceptions()' ++ print('testExceptions()') + result = client.service.throwException() +- print '\nreply( %s )\n' % str(result) +-except WebFault, f: ++ print('\nreply( %s )\n' % str(result)) ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + +-print '\nFinished: errors=%d' % errors ++print('\nFinished: errors=%d' % errors) +diff --git a/tests/external/axis2.py b/tests/external/axis2.py +index 0a64a8f..00b6ffd 100644 +--- a/tests/external/axis2.py ++++ b/tests/external/axis2.py +@@ -24,7 +24,7 @@ from datetime import datetime + + errors = 0 + url = 'http://localhost:8080/axis2/services/BasicService?wsdl' +-print 'url=%s' % url ++print('url=%s' % url) + + # + # create a service client using the wsdl. +@@ -34,25 +34,25 @@ client = Client(url) + # + # print the service (introspection) + # +-print client ++print(client) + +-print 'printList()' +-print client.service.printList(['a','b']) ++print('printList()') ++print(client.service.printList(['a','b'])) + + # + # create a name object using the wsdl + # +-print 'create name' ++print('create name') + name = client.factory.create('ns2:Name') +-name.first = u'jeff'+unichr(1234) ++name.first = u'jeff'+chr(1234) + name.last = 'ortel' + +-print name ++print(name) + + # + # create a phone object using the wsdl + # +-print 'create phone' ++print('create phone') + phoneA = client.factory.create('ns2:Phone') + phoneA.npa = 410 + phoneA.nxx = 822 +@@ -67,10 +67,10 @@ phoneB.number = 4406 + # create a dog + # + dog = client.factory.create('ns2:Dog') +-print dog ++print(dog) + dog.name = 'Chance' + dog.trained = True +-print dog ++print(dog) + + # + # create a person object using the wsdl +@@ -80,7 +80,7 @@ person = client.factory.create('ns2:Person') + # + # inspect empty person + # +-print '{empty} person=\n%s' % person ++print('{empty} person=\n%s' % person) + + person.name = name + person.age = None +@@ -92,14 +92,14 @@ person.pets.append(dog) + # + # inspect person + # +-print 'person=\n%s' % person ++print('person=\n%s' % person) + + # + # add the person (using the webservice) + # +-print 'addPersion()' ++print('addPersion()') + result = client.service.addPerson(person) +-print '\nreply(\n%s\n)\n' % result.encode('utf-8') ++print('\nreply(\n%s\n)\n' % result.encode('utf-8')) + + # + # create a new name object used to update the person +@@ -111,96 +111,96 @@ newname.last = None + # + # update the person's name (using the webservice) and print return person object + # +-print 'updatePersion()' ++print('updatePersion()') + result = client.service.updatePerson(person, newname) +-print '\nreply(\n%s\n)\n' % str(result) ++print('\nreply(\n%s\n)\n' % str(result)) + result = client.service.updatePerson(person, None) +-print '\nreply(\n%s\n)\n' % str(result) ++print('\nreply(\n%s\n)\n' % str(result)) + + + # + # invoke the echo service + # +-print 'echo()' ++print('echo()') + client.service.echo(None) + result = client.service.echo('this is cool') +-print '\nreply( %s )\n' % str(result) ++print('\nreply( %s )\n' % str(result)) + +-print 'echo() with {none}' ++print('echo() with {none}') + result = client.service.echo(None) +-print '\nreply( %s )\n' % str(result) ++print('\nreply( %s )\n' % str(result)) + + # + # invoke the hello service + # +-print 'hello()' ++print('hello()') + result = client.service.hello() +-print '\nreply( %s )\n' % str(result) ++print('\nreply( %s )\n' % str(result)) + + # + # invoke the testVoid service + # + try: +- print 'getVoid()' ++ print('getVoid()') + result = client.service.getVoid() +- print '\nreply( %s )\n' % str(result) +-except Exception, e: +- print e ++ print('\nreply( %s )\n' % str(result)) ++except Exception as e: ++ print(e) + + # + # test list args + # +-print 'getList(list)' ++print('getList(list)') + mylist = ['my', 'dog', 'likes', 'steak'] + result = client.service.printList(mylist) +-print '\nreply( %s )\n' % str(result) ++print('\nreply( %s )\n' % str(result)) + # tuple +-print 'testListArgs(tuple)' ++print('testListArgs(tuple)') + mylist = ('my', 'dog', 'likes', 'steak') + result = client.service.printList(mylist) +-print '\nreply( %s )\n' % str(result) ++print('\nreply( %s )\n' % str(result)) + + # + # test list returned + # + for n in range(0, 3): +- print 'getList(str, %d)' % n ++ print('getList(str, %d)' % n) + result = client.service.getList('hello', n) +- print '\nreply( %s )\n' % str(result) ++ print('\nreply( %s )\n' % str(result)) + assert ( isinstance(result, list) and len(result) == n ) + +-print 'addPet()' ++print('addPet()') + dog = client.factory.create('ns2:Dog') + dog.name = 'Chance' + dog.trained = True +-print dog ++print(dog) + try: + result = client.service.addPet(person, dog) +- print '\nreply( %s )\n' % str(result) +-except Exception, e: +- print e ++ print('\nreply( %s )\n' % str(result)) ++except Exception as e: ++ print(e) + +-print '___________________ E X C E P T I O N S __________________________' ++print('___________________ E X C E P T I O N S __________________________') + + # + # test exceptions + # + try: +- print 'throwException() faults=True' ++ print('throwException() faults=True') + result = client.service.throwException() +- print '\nreply( %s )\n' % tostr(result) +-except Exception, e: +- print e ++ print('\nreply( %s )\n' % tostr(result)) ++except Exception as e: ++ print(e) + + # + # test faults + # + try: +- print 'throwException() faults=False' ++ print('throwException() faults=False') + client.set_options(faults=False) + result = client.service.throwException() +- print '\nreply( %s )\n' % tostr(result) +-except Exception, e: +- print e ++ print('\nreply( %s )\n' % tostr(result)) ++except Exception as e: ++ print(e) + +-print '\nfinished: errors=%d' % errors ++print('\nfinished: errors=%d' % errors) +diff --git a/tests/external/jasper.py b/tests/external/jasper.py +index fde34d5..f901500 100644 +--- a/tests/external/jasper.py ++++ b/tests/external/jasper.py +@@ -26,22 +26,22 @@ errors = 0 + + + def start(url): +- print '\n________________________________________________________________\n' +- print 'Test @ ( %s )' % url ++ print('\n________________________________________________________________\n') ++ print('Test @ ( %s )' % url) + + try: + url = 'http://localhost:9090/jasperserver-pro/services/repository?wsdl' + start(url) + client = Client(url, username='jeff', password='ortel') +- print client +- print client.service.list('') +-except WebFault, f: ++ print(client) ++ print(client.service.list('')) ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + +-print '\nFinished: errors = %d' % errors ++print('\nFinished: errors = %d' % errors) +diff --git a/tests/external/public.py b/tests/external/public.py +index c1b9666..7633c3b 100644 +--- a/tests/external/public.py ++++ b/tests/external/public.py +@@ -28,151 +28,151 @@ errors = 0 + + def start(url): + global errors +- print '\n________________________________________________________________\n' +- print 'Test @ ( %s ) %d' % (url, errors) ++ print('\n________________________________________________________________\n') ++ print('Test @ ( %s ) %d' % (url, errors)) + + try: + url = 'http://mssoapinterop.org/asmx/simple.asmx?WSDL' + start(url) + client = Client(url) +- print client ++ print(client) + # string + input = "42" + d = dict(inputString=input) + result = client.service.echoString(**d) +- print 'echoString() = %s' % result ++ print('echoString() = %s' % result) + assert result == input + # int + input = 42 + result = client.service.echoInteger(input) +- print 'echoInteger() = %s' % result ++ print('echoInteger() = %s' % result) + assert result == input + # float + input = 4.2 + result = client.service.echoFloat(input) +- print 'echoFloat() = %s' % result ++ print('echoFloat() = %s' % result) + assert result == input + # suds 0.3.8+ + result = client.service.echoIntegerArray([]) +- print 'echoIntegerArray() = %s' % result ++ print('echoIntegerArray() = %s' % result) + assert result is None + input = [1,2,3,4] + result = client.service.echoIntegerArray(input) +- print 'echoIntegerArray() = %s' % result ++ print('echoIntegerArray() = %s' % result) + assert result == input + result = client.service.echoIntegerArray(inputIntegerArray=input) +- print 'echoIntegerArray() = %s' % result ++ print('echoIntegerArray() = %s' % result) + assert result == input +-except WebFault, f: ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: + url = 'http://jira.atlassian.com/rpc/soap/jirasoapservice-v2?wsdl' + start(url) + client = Client(url) +- print client ++ print(client) + token = client.service.login('soaptester', 'soaptester') +- print 'token="%s"' % token ++ print('token="%s"' % token) + user = client.service.getUser(token, 'soaptester') +- print 'user="%s"' % user +-except WebFault, f: ++ print('user="%s"' % user) ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: + url = 'http://jira.atlassian.com/rpc/soap/jirasoapservice-v2?wsdl' + start(url+' ** cloned **') + client = Client(url).clone() +- print '**clone**\n%s' % client ++ print('**clone**\n%s' % client) + token = client.service.login('soaptester', 'soaptester') +- print '**clone** token="%s"' % token ++ print('**clone** token="%s"' % token) + user = client.service.getUser(token, 'soaptester') +- print '**clone** user="%s"' % user +-except WebFault, f: ++ print('**clone** user="%s"' % user) ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: + url = ' http://www.boyzoid.com/comp/randomQuote.cfc?wsdl ' + start(url) + client = Client(url) +- print client +- print client.service.getQuote(False) +-except WebFault, f: ++ print(client) ++ print(client.service.getQuote(False)) ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: + url = 'http://www.zenfolio.com/zf/api/zfapi.asmx?wsdl' + start(url) + client = Client(url) +- print client ++ print(client) + #client.setport(0) + group = client.factory.create('Group') +- print 'Group:\n%s' % group +- print 'LoadGroupHierarchy("demo")' ++ print('Group:\n%s' % group) ++ print('LoadGroupHierarchy("demo")') + groupHierarchy = client.service.LoadGroupHierarchy("demo") +- print 'result:\n%s' % groupHierarchy +-except WebFault, f: ++ print('result:\n%s' % groupHierarchy) ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: + url = 'http://cert.synxis.com/interface/ChannelConnect.asmx?WSDL' + start(url) + client = Client(url) +- print client ++ print(client) + #client.setport(0) + tpa = client.factory.create('ns1:TPA_Extensions') +- print client.service.Ping(tpa, "hello") +-except WebFault, f: ++ print(client.service.Ping(tpa, "hello")) ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: + url = 'https://sec.neurofuzz-software.com/paos/genSSHA-SOAP.php?wsdl' + start(url) + client = Client(url) +- print client +- print client.service.genSSHA('hello', 'sha1') +-except WebFault, f: ++ print(client) ++ print(client.service.genSSHA('hello', 'sha1')) ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: +@@ -180,79 +180,79 @@ try: + start(url) + client = Client(url) + #print client.factory.resolver.schema +- print client +- print 'Logon()' ++ print(client) ++ print('Logon()') + reply = client.service.Logon('testuser','test') +- print reply +-except WebFault, f: ++ print(reply) ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: + url = 'http://soa.ebrev.info/service.wsdl' + start(url) + client = Client(url) +- print client +-except WebFault, f: ++ print(client) ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: + url = 'http://arcweb.esri.com/services/v2/MapImage.wsdl' + start(url) + client = Client(url) +- print client ++ print(client) + env = client.factory.create('ns2:Envelope') +- print env ++ print(env) + options = client.factory.create('ns4:MapImageOptions') +- print options +-except WebFault, f: ++ print(options) ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: + url = "http://www.thomas-bayer.com/axis2/services/BLZService?wsdl" + start(url) + client = Client(url) +- print client ++ print(client) + #client.setport(0) +- print client.service.getBank("76251020") +-except WebFault, f: ++ print(client.service.getBank("76251020")) ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: + url = "http://arcweb.esri.com/services/v2/RouteFinder.wsdl" + start(url) + client = Client(url) +- print client +-except WebFault, f: ++ print(client) ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + timer = metrics.Timer() +@@ -264,19 +264,19 @@ try: + client = Client(url) + #client.setport(0) + timer.stop() +- print 'create client: %s' % timer ++ print('create client: %s' % timer) + timer.start() + s = str(client) + timer.stop() +- print 'str(client): %s' % timer +- print 'client:\n%s' % s +-except WebFault, f: ++ print('str(client): %s' % timer) ++ print('client:\n%s' % s) ++except WebFault as f: + errors += 1 +- print f +- print f.fault +-except Exception, e: ++ print(f) ++ print(f.fault) ++except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + +-print '\nFinished: errors = %d' % errors ++print('\nFinished: errors = %d' % errors) +diff --git a/tests/external/rhq.py b/tests/external/rhq.py +index c17d578..e6982fe 100644 +--- a/tests/external/rhq.py ++++ b/tests/external/rhq.py +@@ -32,8 +32,8 @@ errors = 0 + + def start(url): + global errors +- print '\n________________________________________________________________\n' +- print 'Test @ ( %s ) %d' % (url, errors) ++ print('\n________________________________________________________________\n') ++ print('Test @ ( %s ) %d' % (url, errors)) + + + def rhqTest(): +@@ -43,7 +43,7 @@ def rhqTest(): + url = 'http://localhost.localdomain:7080/rhq-rhq-enterprise-server-ejb3/WebservicesManagerBean?wsdl' + start(url) + client = Client(url) +- print client ++ print(client) + + try: + +@@ -51,7 +51,7 @@ def rhqTest(): + # create name + # + name = client.factory.create('name') +- name.first = u'Jeff'+unichr(1234) ++ name.first = 'Jeff'+chr(1234) + name.last = 'Ortel &lt; Company' + # + # create a phone object using the wsdl +@@ -77,22 +77,22 @@ def rhqTest(): + # create a person object using the wsdl + # + person = client.factory.create('person') +- print person ++ print(person) + person.name = name + person.age = 43 + person.phone.append(phoneA) + person.phone.append(phoneB) + person.pet.append(dog) + person.pet.append(cat) +- print person ++ print(person) + # + # addPerson() + # +- print 'addPersion()' ++ print('addPersion()') + result = client.service.addPerson(person) + sent = client.last_sent() + rcvd = client.last_received() +- print '\nreply(\n%s\n)\n' % result ++ print('\nreply(\n%s\n)\n' % result) + # + # create a new name object used to update the person + # +@@ -102,110 +102,110 @@ def rhqTest(): + # + # update the person's name (using the webservice) + # +- print 'updatePersion()' ++ print('updatePersion()') + result = client.service.updatePerson(person, newname) +- print '\nreply(\n%s\n)\n' % str(result) ++ print('\nreply(\n%s\n)\n' % str(result)) + result = client.service.updatePerson(person, None) +- print '\nreply(\n%s\n)\n' % str(result) +- except WebFault, f: ++ print('\nreply(\n%s\n)\n' % str(result)) ++ except WebFault as f: + errors += 1 +- print f +- print f.fault +- except Exception, e: ++ print(f) ++ print(f.fault) ++ except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: +- print "echo('this is cool')" ++ print("echo('this is cool')") + result = client.service.echo('this is cool') +- print '\nreply( %s )\n' % str(result) +- print 'echo(None)' ++ print('\nreply( %s )\n' % str(result)) ++ print('echo(None)') + result = client.service.echo(None) +- print '\nreply( %s )\n' % str(result) +- except WebFault, f: ++ print('\nreply( %s )\n' % str(result)) ++ except WebFault as f: + errors += 1 +- print f +- print f.fault +- except Exception, e: ++ print(f) ++ print(f.fault) ++ except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: +- print 'hello()' ++ print('hello()') + result = client.service.hello() +- print '\nreply( %s )\n' % str(result) +- except WebFault, f: ++ print('\nreply( %s )\n' % str(result)) ++ except WebFault as f: + errors += 1 +- print f +- print f.fault +- except Exception, e: ++ print(f) ++ print(f.fault) ++ except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: +- print 'testVoid()' ++ print('testVoid()') + result = client.service.testVoid() +- print '\nreply( %s )\n' % str(result) +- except WebFault, f: ++ print('\nreply( %s )\n' % str(result)) ++ except WebFault as f: + errors += 1 +- print f +- print f.fault +- except Exception, e: ++ print(f) ++ print(f.fault) ++ except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: + mylist = ['my', 'dog', 'likes', 'steak'] +- print 'testListArgs(%s)' % mylist ++ print('testListArgs(%s)' % mylist) + result = client.service.testListArg(mylist) +- print '\nreply( %s )\n' % str(result) +- except WebFault, f: ++ print('\nreply( %s )\n' % str(result)) ++ except WebFault as f: + errors += 1 +- print f +- print f.fault +- except Exception, e: ++ print(f) ++ print(f.fault) ++ except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: + s = 'hello' + for n in range(0, 3): +- print 'getList(%s, %d)' % (s, n) ++ print('getList(%s, %d)' % (s, n)) + result = client.service.getList(s, n) +- print '\nreply( %s )\n' % str(result) ++ print('\nreply( %s )\n' % str(result)) + if len(result) != n: + errors += 1 +- print 'expected (%d), reply (%d)' % (n, len(result)) +- except WebFault, f: ++ print('expected (%d), reply (%d)' % (n, len(result))) ++ except WebFault as f: + errors += 1 +- print f +- print f.fault +- except Exception, e: ++ print(f) ++ print(f.fault) ++ except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + try: +- print 'testExceptions()' ++ print('testExceptions()') + result = client.service.testExceptions() +- print '\nreply( %s )\n' % tostr(result) ++ print('\nreply( %s )\n' % tostr(result)) + raise Exception('Fault expected and not raised') +- except WebFault, f: +- print f +- print f.fault +- print f.document +- except Exception, e: ++ except WebFault as f: ++ print(f) ++ print(f.fault) ++ print(f.document) ++ except Exception as e: + errors += 1 +- print e ++ print(e) + tb.print_exc() + + + if __name__ == '__main__': + errors = 0 + rhqTest() +- print '\nFinished: errors=%d' % errors ++ print('\nFinished: errors=%d' % errors) +diff --git a/tests/external/saxenc.py b/tests/external/saxenc.py +index 1bb351c..848e45c 100644 +--- a/tests/external/saxenc.py ++++ b/tests/external/saxenc.py +@@ -26,30 +26,30 @@ def basic(): + p = Parser() + d = p.parse(string=xml) + a = d.root() +- print 'A(parsed)=\n%s' % a ++ print('A(parsed)=\n%s' % a) + assert str(a) == xml + b = Element('a') + b.setText('Me && <b>my shadow\'s dog love to \'play\' and sing "la,la,la";') +- print 'B(encoded)=\n%s' % b ++ print('B(encoded)=\n%s' % b) + assert str(b) == xml +- print 'A(text-decoded)=\n%s' % a.getText() +- print 'B(text-decoded)=\n%s' % b.getText() ++ print('A(text-decoded)=\n%s' % a.getText()) ++ print('B(text-decoded)=\n%s' % b.getText()) + assert a.getText() == b.getText() +- print 'test pruning' ++ print('test pruning') + j = Element('A') + j.set('n', 1) + j.append(Element('B')) +- print j ++ print(j) + j.prune() +- print j ++ print(j) + + def cdata(): + xml = 'This is my &<tag>]]>' + p = Parser() + d = p.parse(string=xml) +- print d ++ print(d) + a = d.root() +- print a.getText() ++ print(a.getText()) + + if __name__ == '__main__': + #basic() -- Gitee