-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expand options for accessing secured thredds data #272
Comments
AFAIU, complex authentication with But Magpie doesn't work like that, it uses an authentication call that return a cookie to be used in further calls. I have not been able to use this cookie in a way that made FYI: netCDF4 and pydap are the only official xarray engines that support OpenDAP. |
@huard FYI Magpie does not support simple HTTP authentication ( What Magpie does support, and which is parsed by the
I'm not too familiar with the internals of Alternatively, if there is a way to pass down the |
Sadly, this is exactly what The other choice is The easiest way out might be fixing |
Indeed. Fixing I'm reading a bit on https://docs.unidata.ucar.edu/netcdf/documentation/4.8.0/md__home_wfisher_Desktop_v4_88_80_netcdf-c_docs_auth.html#auth_redir. If I understand correctly, the alternative with with tempfile.TemporaryDirectory() as tmp_dir:
auth_path = os.path.join(tmp_dir, ".daprc")
with open(auth_path, mode="w", encoding="utf-8") as auth_file:
auth_file.write(f"HTTP.COOKIEJAR={MAGPIE_COOKIE}") # from previous auth request
with mock.patch.dict("os.environ", {"DAPRCFILE": auth_path}):
xr.open_dataset("<url>") If everything resolves correctly, this should work (remains to be tested). The danger with using the RC files is if a user leaves them in the workspace, it is a potential security leak. |
Currently accessing secured PAVICS thredds data only seems possible via a
pydap
backend (e.g. seen here : https://pavics-sdi.readthedocs.io/en/latest/notebooks/pavics_thredds.html or more simply viaxr.open_dataset(secure_url, session=session, engine='pydap')
However, there are issues with
pydap
working withdask.distributed
that make it a less desireable option. See pydata/xarray#4348 and pydap/pydap#256Ideally there would be methods to access the secured data with at least the default
netcdf4
engine and perhaps othersThe text was updated successfully, but these errors were encountered: