def __init__(self, url, version='<STR_LIT>', xml=None,<EOL>username=None,<EOL>password=None,<EOL>parse_remote_metadata=False,<EOL>headers=None,<EOL>timeout=<NUM_LIT:30>):
self.url = url<EOL>self.username = username<EOL>self.password = password<EOL>self.version = version<EOL>self.timeout = timeout<EOL>self.headers = headers<EOL>self._capabilities = None<EOL>reader = WMSCapabilitiesReader(self.version, url=self.url,<EOL>un=self.username, pw=self.password,<EOL>headers=headers)<EOL>if xml:  <EOL><INDENT>self._capabilities = reader.readString(xml)<EOL><DEDENT>else:  <EOL><INDENT>self._capabilities = reader.read(self.url, timeout=self.timeout)<EOL><DEDENT>self.request = reader.request<EOL>se = self._capabilities.find('<STR_LIT>')<EOL>if se is not None:<EOL><INDENT>err_message = str(se.text).strip()<EOL>raise ServiceException(err_message)<EOL><DEDENT>self._buildMetadata(parse_remote_metadata)<EOL>
Initialize.