def _get_xml_data(self): """Return the raw XML data for this DOV object. Returns ------- xml : bytes The raw XML data of this DOV object as bytes. """ if pydov.cache: return pydov.cache.get(self.pkey + '.xml') else: xml = get_dov_xml(self.pkey + '.xml') HookRunner.execute_xml_downloaded(self.pkey) return xml
def _get_remote(self, url): """Get the XML data by requesting it from the given URL. Parameters ---------- url : str Permanent URL to a DOV object. Returns ------- xml : bytes The raw XML data of this DOV object as bytes. """ xml = get_dov_xml(url) HookRunner.execute_xml_downloaded(url.rstrip('.xml')) return xml
def _get_xml_data(self): """Return the raw XML data for this DOV object. Returns ------- xml : bytes The raw XML data of this DOV object as bytes. """ for hook in pydov.hooks: hook.xml_requested(self.pkey) if pydov.cache: return pydov.cache.get(self.pkey + '.xml') else: xml = get_dov_xml(self.pkey + '.xml') for hook in pydov.hooks: hook.xml_downloaded(self.pkey) return xml
def _get_remote(self, url, session=None): """Get the XML data by requesting it from the given URL. Parameters ---------- url : str Permanent URL to a DOV object. session : requests.Session Session to use to perform HTTP requests for data. Defaults to None, which means a new session will be created for each request. Returns ------- xml : bytes The raw XML data of this DOV object as bytes. """ xml = get_dov_xml(url, session) HookRunner.execute_xml_downloaded(url.rstrip('.xml')) return xml
def _get_xml_data(self, session=None): """Return the raw XML data for this DOV object. Parameters ---------- session : requests.Session Session to use to perform HTTP requests for data. Defaults to None, which means a new session will be created for each request. Returns ------- xml : bytes The raw XML data of this DOV object as bytes. """ if pydov.cache: return pydov.cache.get(self.pkey + '.xml', session) else: xml = get_dov_xml(self.pkey + '.xml', session) HookRunner.execute_xml_downloaded(self.pkey) return xml