DALQuery

class pyvo.dal.DALQuery(baseurl, session=None, **keywords)[source]

Bases: dict

a class for preparing a query to a particular service. Query constraints are added via its service type-specific methods. The various execute() functions will submit the query and return the results.

The base URL for the query can be changed via the baseurl property.

A session can also optionally be passed in that will be used for network transactions made by this object to remote services.

initialize the query object with a baseurl

Attributes Summary

baseurl

the base URL that this query will be sent to when one of the execute functions is called.

queryurl

The URL that encodes the current query.

Methods Summary

execute()

submit the query and return the results as a Results subclass instance

execute_raw()

submit the query and return the raw response as a string.

execute_stream([post])

Submit the query and return the raw response as a file stream.

execute_votable([post])

Submit the query and return the results as an AstroPy votable instance.

raise_if_error()

Raise if there was an error on http level.

submit([post])

does the actual request

Attributes Documentation

baseurl

the base URL that this query will be sent to when one of the execute functions is called.

queryurl

The URL that encodes the current query. This is the URL that the execute functions will use if called next.

Methods Documentation

execute()[source]

submit the query and return the results as a Results subclass instance

Raises
DALServiceError

for errors connecting to or communicating with the service

DALQueryError

for errors either in the input query syntax or other user errors detected by the service

DALFormatError

for errors parsing the VOTable response

execute_raw()[source]

submit the query and return the raw response as a string.

No exceptions are raised here because non-2xx responses might still contain payload. They can be raised later by calling raise_if_error

execute_stream(post=False)[source]

Submit the query and return the raw response as a file stream.

No exceptions are raised here because non-2xx responses might still contain payload. They can be raised later by calling raise_if_error

execute_votable(post=False)[source]

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.VOTableFile

an Astropy votable object

Raises
DALServiceError

for errors connecting to or communicating with the service

DALFormatError

for errors parsing the VOTable response

raise_if_error()[source]

Raise if there was an error on http level.

submit(post=False)[source]

does the actual request