MastClass¶
-
class
astroquery.mast.
MastClass
(username=None, password=None, session_token=None)[source]¶ Bases:
astroquery.query.QueryWithLogin
MAST query class.
Class that allows direct programatic access to the MAST Portal, more flexible but less user friendly than
ObservationsClass
.Methods Summary
get_token
()Returns MAST session cookie. login
([username, password, session_token, …])Log into the MAST portal. logout
()Log out of current MAST session. service_request
(*args, **kwargs)Queries the service and returns a table object. service_request_async
(service, params[, …])Given a Mashup service and parameters, builds and excecutes a Mashup query. session_info
([silent])Displays information about current MAST session, and returns session info dictionary. Methods Documentation
-
login
(username=None, password=None, session_token=None, store_password=False, reenter_password=False)[source]¶ Log into the MAST portal.
Parameters: username : string, optional
Default is None. The username for the user logging in. Usually this will be the user’s email address. If a username is necessary but not supplied it will be prompted for.
password : string, optional
Default is None. The password associated with the given username. For security passwords should not be typed into the terminal or jupyter notebook, but input using a more secure method such as
getpass
. If a password is necessary but not supplied it will be prompted for.session_token : dict or
Cookie
, optionalA valid MAST session cookie that will be attached to the current session in lieu of logging in with a username/password. If username and/or password is supplied, this argument will be ignored.
store_password : bool, optional
Default False. If true, username and password will be stored securely in your keyring.
reenter_password : bool, optional
Default False. Asks for the password even if it is already stored in the keyring. This is the way to overwrite an already stored password on the keyring.
-
service_request
(*args, **kwargs)¶ Queries the service and returns a table object.
Given a Mashup service and parameters, builds and excecutes a Mashup query. See documentation here for information about how to build a Mashup request.
Parameters: service : str
The Mashup service to query.
params : dict
JSON object containing service parameters.
pagesize : int, optional
Default None. Can be used to override the default pagesize (set in configs) for this query only. E.g. when using a slow internet connection.
page : int, optional
Default None. Can be used to override the default behavior of all results being returned to obtain a specific page of results.
**kwargs :
See MashupRequest properties here for additional keyword arguments.
Returns: table : A
Table
object.
-
service_request_async
(service, params, pagesize=None, page=None, **kwargs)[source]¶ Given a Mashup service and parameters, builds and excecutes a Mashup query. See documentation here for information about how to build a Mashup request.
Parameters: service : str
The Mashup service to query.
params : dict
JSON object containing service parameters.
pagesize : int, optional
Default None. Can be used to override the default pagesize (set in configs) for this query only. E.g. when using a slow internet connection.
page : int, optional
Default None. Can be used to override the default behavior of all results being returned to obtain a specific page of results.
**kwargs :
See MashupRequest properties here for additional keyword arguments.
Returns: response : list of
requests.Response
-