CasJobsTask#
- class astropathdb.db_io.dbconnect.CasJobsTask#
Builds various
CasJobsheader formats and handles responses.Most logic is simplified and reused from the
SciScript-Python. This is NOT a user facing class, useCasJobsUrllib3Clientto submit low level requests with this API. Preferably, please useAstroDBto create a database connection.
CasJobsTask Methods#
|
Get the |
|
Set the token and 'Accept' in |
|
Format |
CasJobsTask References#
Method Reference#
- static get_taskname(task_id)#
Get the
CasJobstask name for a local or SciServer compute client.
Private Attribute Reference#
- attribute _headers: dict[str, str]#
Headers for the
CasJobsrequest.‘Content-Type’ is always ‘application/json’. The ‘X-Auth-Token’ and ‘Accept’ headers are set by
set_headers()before each request.
Private Property Reference#
- property _token#
-
Gets the token and validates that it is not empty.
Note that we always require a token… for some reason
CasJobswill still pass the query and lets the server kick back an error in theexecuteQueryfunction.- Returns:
The authentication token from
Authentication.getToken.- Raises:
CasJobsLoginError – No SciServer login token is set.
- Return type:
Private Method Reference#
- static __format_to_accept_header(accept_format)#
Map an output
accept_formatto its ‘Accept’ header value.Simplified
SciScript-Pythonlookup. Formats parsed by_format_response()map to “application/json+array”. TheSciScript-Pythontext (“csv”, “readable”, “StringIO”) and fits (“fits”, “BytesIO”) formats map to “text/plain” and “application/fits”; their responses are not parsed by this client.- Parameters:
accept_format (str) – The output format name.
- Returns:
The ‘Accept’ header value.
- Raises:
CasJobsInvalidFormatError –
accept_formatis not a known format.- Return type: