Skip to content

Handling ERDDAP endpoints with authentication #13

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

Open
rsignell-usgs opened this issue Nov 14, 2017 · 7 comments
Open

Handling ERDDAP endpoints with authentication #13

rsignell-usgs opened this issue Nov 14, 2017 · 7 comments

Comments

@rsignell-usgs
Copy link
Member

I'd like to use erddapy with an ERDDAP endpoint that is protected with basic authentication (username/password): https://cgoms.coas.oregonstate.edu/erddap

If we were just using requests, we could use this, right?
http://docs.python-requests.org/en/master/user/authentication/

But is that right approach here?

Or should I just give up on expecting we could access protected endpoints with erddapy?

@ocefpaf
Copy link
Member

ocefpaf commented Nov 15, 2017

Or should I just give up on expecting we could access protected endpoints with erddapy?

It is possible. requests will be a required dependency on the next version anyway, so that is not an issue.

The only issue here is developer time 😉

@rsignell-usgs
Copy link
Member Author

I can verify that I'm able to access the protected ERDDAP endpoint http://cgoms.coas.oregonstate.edu/erddap by using requests with a ~/.netrc file that looks like:

machine cgoms.coas.oregonstate.edu
login <myusername>
password <mypassword>

@rsignell-usgs
Copy link
Member Author

@ocefpaf, there is a unmerged PR to pandas to provide authentication:
pandas-dev/pandas#17087
looks like they are close though!

@ocefpaf
Copy link
Member

ocefpaf commented Jan 30, 2018

@rsignell-usgs after thinking about this for a while we should outsource that to the data reader libraries, like pandas, xarray, etc. It seems that pandas is close to support it, if not I'll try to review that PR.

Closing this but if you disagree feel free to re-open it.

@ocefpaf ocefpaf closed this as completed Jan 30, 2018
@rsignell
Copy link

rsignell commented May 5, 2025

@ocefpaf , looks like pandas-dev/pandas#17087 was closed but the auth was never implemented. What should we do? I have another ERDDAP endpoint that uses auth that I'd like to access with erddapy.

@ocefpaf
Copy link
Member

ocefpaf commented May 5, 2025

@ocefpaf , looks like pandas-dev/pandas#17087 was closed but the auth was never implemented.

pandas-dev/pandas#28874 and pandas-dev/pandas#21504 were also closed. Both the original submitter and I gave up on it.

What should we do? I have another ERDDAP endpoint that uses auth that I'd like to access with erddapy.

I don't know if this still works, but in theory you can pass your user and password via environment variables and erddapy will pass them to requests.

e.requests_kwargs.update(
    {"user": os.environ["user"], "password": os.environ["password"]}
)

@ocefpaf
Copy link
Member

ocefpaf commented May 5, 2025

Re-opening this one and xref with #331 so we can keep track of all possible ways to login in an ERDDAP server.

@ocefpaf ocefpaf reopened this May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants