-
Notifications
You must be signed in to change notification settings - Fork 75
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
If TDSCatalog detects html, warn and try an XML link. #32
Conversation
9ec0b34
to
47d76e7
Compare
|
||
# If we were given an HTML link, warn about it and try to fix to xml | ||
if 'html' in resp.headers['content-type']: | ||
import warnings |
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.
Why the warnings package and not logging.warning?
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.
The logic that was suggested before was: logging for warnings of bad conditions that the user may want to know about, but can't do anything about; warnings module for warnings the user should address.
https://docs.python.org/3/howto/logging.html
Specifically: "warnings.warn() in library code if the issue is avoidable and the client application should be modified to eliminate the warning"
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.
Ah yes, I remember now.
My bigger question, is automatically trying a new URL and setting that on the |
I think it's ok to try with xml if the url ends with html. It's a very common cut/paste error when trying to find a catalog url. |
Not just url endswith html, I replace all 'html' in the URL with 'xml'. This is important for URLs like: http://thredds.ucar.edu/thredds/catalog/grib/NCEP/GFS/Global_onedeg/catalog.html?dataset=grib/NCEP/GFS/Global_onedeg/Best |
Ah. Yes. I think that is still ok to do. |
If TDSCatalog detects html, warn and try an XML link.
Fixes #29.