def __init__(self, *, protocol=None, main_resource=None, **kwargs):
self.protocol = protocol() if isinstance(protocol, type) else protocol<EOL>if self.protocol is None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>self.main_resource = (self._parse_resource(<EOL>main_resource if main_resource is not None<EOL>else protocol.default_resource))<EOL>self._base_url = '<STR_LIT>'.format(self.protocol.service_url,<EOL>self.main_resource)<EOL>if self._base_url.endswith('<STR_LIT:/>'):<EOL><INDENT>self._base_url = self._base_url[:-<NUM_LIT:1>]<EOL><DEDENT>super().__init__()<EOL>
Object initialization

        :param Protocol protocol: A protocol class or instance to be used with
         this connection
        :param str main_resource: main_resource to be used in these API
         communications