Пример #1
0
    def __init__(self,
                 uri,
                 transport=None,
                 encoding=None,
                 verbose=False,
                 allow_none=False,
                 use_datetime=False,
                 use_builtin_types=False):
        # establish a "logical" server connection

        # get the url
        type, uri = urllib_parse.splittype(uri)
        if type not in ("http", "https"):
            raise IOError("unsupported XML-RPC protocol")
        self.__host, self.__handler = urllib_parse.splithost(uri)
        if not self.__handler:
            self.__handler = "/RPC2"

        if transport is None:
            if type == "https":
                handler = SafeTransport
            else:
                handler = Transport
            transport = handler(use_datetime=use_datetime,
                                use_builtin_types=use_builtin_types)
        self.__transport = transport

        self.__encoding = encoding or 'utf-8'
        self.__verbose = verbose
        self.__allow_none = allow_none
Пример #2
0
    def __init__(
        self,
        uri,
        transport=None,
        encoding=None,
        verbose=False,
        allow_none=False,
        use_datetime=False,
        use_builtin_types=False,
    ):
        # establish a "logical" server connection

        # get the url
        type, uri = urllib_parse.splittype(uri)
        if type not in ("http", "https"):
            raise IOError("unsupported XML-RPC protocol")
        self.__host, self.__handler = urllib_parse.splithost(uri)
        if not self.__handler:
            self.__handler = "/RPC2"

        if transport is None:
            if type == "https":
                handler = SafeTransport
            else:
                handler = Transport
            transport = handler(use_datetime=use_datetime, use_builtin_types=use_builtin_types)
        self.__transport = transport

        self.__encoding = encoding or "utf-8"
        self.__verbose = verbose
        self.__allow_none = allow_none