diff --git a/src/zeep/client.py b/src/zeep/client.py index fac7ecd7..79f203cf 100644 --- a/src/zeep/client.py +++ b/src/zeep/client.py @@ -55,13 +55,13 @@ class Client: def __init__( self, - wsdl, + wsdl: typing.Union[typing.IO, str], wsse=None, transport=None, service_name=None, port_name=None, plugins=None, - settings=None, + settings: typing.Optional[Settings] = None, ): if not wsdl: raise ValueError("No URL given for the wsdl") diff --git a/src/zeep/exceptions.py b/src/zeep/exceptions.py index 632b3b08..231fb594 100644 --- a/src/zeep/exceptions.py +++ b/src/zeep/exceptions.py @@ -1,5 +1,5 @@ class Error(Exception): - def __init__(self, message=""): + def __init__(self, message: str = ""): super(Exception, self).__init__(message) self.message = message @@ -19,7 +19,7 @@ def __init__(self, *args, **kwargs): self.sourceline = kwargs.pop("sourceline", None) super().__init__(*args, **kwargs) - def __str__(self): + def __str__(self) -> str: location = None if self.filename and self.sourceline: location = "%s:%s" % (self.filename, self.sourceline) @@ -37,7 +37,7 @@ class WsdlSyntaxError(Error): class TransportError(Error): - def __init__(self, message="", status_code=0, content=None): + def __init__(self, message: str = "", status_code=0, content=None): super().__init__(message) self.status_code = status_code self.content = content @@ -56,7 +56,7 @@ class NamespaceError(Error): class Fault(Error): - def __init__(self, message, code=None, actor=None, detail=None, subcodes=None): + def __init__(self, message: str, code=None, actor=None, detail=None, subcodes=None): super().__init__(message) self.message = message self.code = code @@ -74,7 +74,7 @@ def __init__(self, *args, **kwargs): self.path = kwargs.pop("path", []) super().__init__(*args, **kwargs) - def __str__(self): + def __str__(self) -> str: if self.path: path = ".".join(str(x) for x in self.path) return "%s (%s)" % (self.message, path) diff --git a/src/zeep/transports.py b/src/zeep/transports.py index ffde356b..98f94f66 100644 --- a/src/zeep/transports.py +++ b/src/zeep/transports.py @@ -4,7 +4,7 @@ from urllib.parse import urlparse import requests -from requests import Response +from requests import Response as Response from requests_file import FileAdapter from zeep.exceptions import TransportError diff --git a/src/zeep/wsdl/wsdl.py b/src/zeep/wsdl/wsdl.py index f842fa43..cd200590 100644 --- a/src/zeep/wsdl/wsdl.py +++ b/src/zeep/wsdl/wsdl.py @@ -61,7 +61,11 @@ class Document: """ def __init__( - self, location, transport: typing.Type["Transport"], base=None, settings=None + self, + location: typing.Union[typing.IO, str], + transport: typing.Type["Transport"], + base=None, + settings=None ): """Initialize a WSDL document.