-
Notifications
You must be signed in to change notification settings - Fork 84
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
Add dodsrc and urs cookies files when creating netrc #492
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 looks pretty good; I can see the desire for the .urs_cookies
and .dodsrc
(OpenDAP) files.
As written, code will clobber (overwrite) any existing .urs_cookies
and .dodsrc
files, which I don't think is desirable, but I'll have to think more about how best to handle existing versions of these files...
I also left a couple of minor suggestions.
Co-authored-by: Joseph H Kennedy <me@jhkennedy.org>
Co-authored-by: Joseph H Kennedy <me@jhkennedy.org>
Thank you for the reviewing and the suggestions @jhkennedy ! I added the suggested commits here. In terms of overwriting the existing dodsrc file, for Windows environments, you need to have additional copies of the dodsrc file in each working directory even if it exists in the root user folder. I'm not sure how long the information in the urs_cookies file is valid for, but I have not had any issues when overwriting it repeatedly, and this file is necessary for those who want to use wget/curl, so I have included it here for convenience. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@battistowx circling back to this.
I agree overwriting the .urs_cookies
path is not likely a concern, but I don't think there's a benefit to doing so.
For ~/.dodsrc
, I think there's actually a decent amount of risk because:
- there's a lot of configuration that can go into the
~/.dodsrc
, e.g.: - Users may want to specify alternate cookie and netrc files, e.g., Define user .netrc directory [Feature request] #480
How about we only create them if they don't exist?
Co-authored-by: Joseph H Kennedy <me@jhkennedy.org>
Woops! bad indent in my suggestion |
No worries! Fixed them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
This PR includes code that will also create a .urs_cookies and .dodsrc files when users persist their credentials to a .netrc file, and will copy the .dodsrc file based on the user operating system. It is based on code from this how-to, but adapted here to use pathlib: https://disc.gsfc.nasa.gov/information/howto?keywords=prerequisite&title=How%20to%20Generate%20Earthdata%20Prerequisite%20Files
I have tested this with poetry on both Linux/Windows, and it works great!
📚 Documentation preview 📚: https://earthaccess--492.org.readthedocs.build/en/492/