Package gavo :: Package votable :: Module tapquery
[frames] | no frames]

Module tapquery

source code

An interface to querying TAP servers (i.e., a TAP client).

Classes
  Error
The base class for all TAP-related exceptions.
  ProtocolError
is raised when the remote server violated the local assumptions.
  WrongStatus
is raised when request detects the server returned an invalid status.
  RemoteError
is raised when the remote size signals an error.
  RemoteAbort
is raised by certain check functions when the remote side has aborted the job.
  NetworkError
is raised when a generic network error happens (can't connect,...)
  UWSResult
a container type for a result returned by an UWS service.
  LocalResult
  ADQLTAPJob
A facade for an ADQL-based async TAP job.
  ADQLSyncJob
A facade for a synchronous TAP Job.
  ADQLEndpoint
A facade for an ADQL endpoint.
Functions
 
request(scheme, host, path, data='', customHeaders={}, method='GET', expectedStatus=None, followRedirects=False, setResponse=None, timeout=None)
returns a HTTPResponse object for an HTTP request to path on host.
source code
Variables
  PENDING = 'PENDING'
  QUEUED = 'QUEUED'
  EXECUTING = 'EXECUTING'
  COMPLETED = 'COMPLETED'
  ERROR = 'ERROR'
  ABORTED = 'ABORTED'
  UNKNOWN = 'UNKNOWN'
  debug = False
  __package__ = 'gavo.votable'
Function Details

request(scheme, host, path, data='', customHeaders={}, method='GET', expectedStatus=None, followRedirects=False, setResponse=None, timeout=None)

source code 

returns a HTTPResponse object for an HTTP request to path on host.

This function builds a new connection for every request.

On the returned object, you cannot use the read() method. Instead any data returned by the server is available in the data attribute.

data usually is a byte string, but you can also pass a dictionary which then will be serialized using _FormData above.

You can set followRedirects to True. This means that the 303 "See other" codes that many UWS action generate will be followed and the document at the other end will be obtained. For many operations this will lead to an error; only do this for slightly broken services.

In setResponse, you can pass in a callable that is called with the server response body as soon as it is in. This is for when you want to store the response even if request raises an error later on (i.e., for sync querying).