Helioviewer-Project / python-api

Python wrapper around the Helioviewer API.
https://hvpy.readthedocs.io/en/latest/
BSD 2-Clause "Simplified" License
6 stars 5 forks source link

`api_url` should be easily configurable from the user's code #92

Open ebuchlin opened 1 year ago

ebuchlin commented 1 year ago

api_url is currently hard-coded as https://api.helioviewer.org/v2/ in hvpy.config.Settings, although the use of pydantic.Field allows this to be overriden by environment variable HELIOVIEWER_API_URL.

Other servers, such as the MEDOC/IAS server, can be available when the GSFC server is not available or not up-to-date with the latest data, or can have additional datasets (e.g. Solar Orbiter at ESA). They should also be usable with hvpy.

For the user, it is more convenient to have the possibility to choose the server on the fly, rather than setting an environment variable (which is undocumented). This was possible with sunpy.net.helioviewer as the server was a parameter of HelioviewerClient(), but it doesn't appear that it is currently possible with hvpy.

See also @wafels 's comment on #52.

nabobalis commented 1 year ago

Can you see if hvpy.set_api_url works?

ebuchlin commented 1 year ago

It works, thanks! I should have looked until the end of config.py, sorry. I have now seen the reference documentation for set_api_url(), I wonder if there could be something about it in the User guide.

nabobalis commented 1 year ago

Yeah there are a lot of improvements to be made for the user guide, this is one of them.