def execute_votable(self, post=False): """ Submit the query and return the results as an AstroPy votable instance. As this is the level where qualified error messages are available, they are raised here instead of in the underlying execute_stream. Returns ------- astropy.io.votable.tree.Table an Astropy votable Table instance Raises ------ DALServiceError for errors connecting to or communicating with the service DALFormatError for errors parsing the VOTable response See Also -------- astropy.io.votable DALServiceError DALFormatError DALQueryError """ try: return votableparse(self.execute_stream(post=post).read) except Exception as e: self.raise_if_error() raise DALFormatError(e, self.queryurl)
def from_result_url(cls, result_url): """ Create a result object from a url. """ return cls( votableparse(cls._from_result_url(result_url).read), url=result_url)
def execute_votable(self): """ Submit the query and return the results as an AstroPy votable instance. As this is the level where qualified error messages are available, they are raised here instead of in the underlying execute_stream. Returns ------- astropy.io.votable.tree.Table an Astropy votable Table instance Raises ------ DALServiceError for errors connecting to or communicating with the service DALFormatError for errors parsing the VOTable response See Also -------- astropy.io.votable DALServiceError DALFormatError DALQueryError """ try: return votableparse(self.execute_stream().read) except Exception as e: self.raise_if_error() raise DALFormatError(e, self.queryurl)
def fetch_result(self): """ returns the result votable if query is finished """ response = self.get_result_response() response.raw.read = partial( response.raw.read, decode_content=True) return TAPResults(votableparse(response.raw.read), url=self.result_uri, session=self._session)
def from_result_url(cls, result_url, session=None): """ Create a result object from a url. Uses the optional session to make the request. """ session = use_session(session) return cls(votableparse( cls._from_result_url(result_url, session).read), url=result_url, session=session)
def fetch_result(self): """ returns the result votable if query is finished """ try: response = session.get(self.result_uri, stream=True) response.raise_for_status() except requests.RequestException as ex: self._update() # we propably got a 404 because query error. raise with error msg self.raise_if_error() raise DALServiceError.from_except(ex, self.url) response.raw.read = partial(response.raw.read, decode_content=True) return TAPResults(votableparse(response.raw.read), url=self.result_uri)
def fetch_result(self): """ returns the result votable if query is finished """ try: response = s.get(self.result_uri, stream=True) response.raise_for_status() except requests.RequestException as ex: self._update() # we propably got a 404 because query error. raise with error msg self.raise_if_error() raise DALServiceError.from_except(ex, self.url) response.raw.read = partial( response.raw.read, decode_content=True) return TAPResults(votableparse(response.raw.read), url=self.result_uri)