Following up on our discussion during the Heliopython meeting, I thought I would provide my suggestions here. The purpose of these suggestions is also to make it easier to document the input arguments.
First, the client object should be instantiable regardless of whether the server is available therefore
This should return an instance ready to connect to the url. It would then be worhwhile to provide a test of server availability such as
Using this API would match that used by the Python socket module. It would return False if it does not get a response from the server so that something like the following would be possible
if h.connect():
do something
Once the connection is established, information could be asked for on the dataset available from the server with
list_of_datasets = h.info()
Next a user would likely want to connect to a particular dataset and then ask for data. This could be done as following
h.set_dataset(list_of_datasets[0])
data = h.get_data(start_time, end_time)
If a user wanted to get the data from all datasets then they could easily run
for this_dataset in list_of_datasets:
h.set_dataset(this_dataset)
data = h.get_data(start_time, end_time)
It may also be worthwhile to provide the optional argument with instantiating to enable the following
with hapi(url, connect=True) as h:
do something with h
Following up on our discussion during the Heliopython meeting, I thought I would provide my suggestions here. The purpose of these suggestions is also to make it easier to document the input arguments.
First, the client object should be instantiable regardless of whether the server is available therefore
This should return an instance ready to connect to the
url. It would then be worhwhile to provide a test of server availability such asUsing this API would match that used by the Python socket module. It would return
Falseif it does not get a response from the server so that something like the following would be possibleOnce the connection is established, information could be asked for on the dataset available from the server with
Next a user would likely want to connect to a particular dataset and then ask for data. This could be done as following
If a user wanted to get the data from all datasets then they could easily run
It may also be worthwhile to provide the optional argument with instantiating to enable the following