Skip to content
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

Suppress urllib3 warning #134

Merged
merged 1 commit into from
Apr 8, 2022
Merged

Conversation

pbattaglia
Copy link
Collaborator

This comes from urllib3 through cdsapi. It spams logging output in local runs, but doesn't seem important.
Here's what it looks like:

urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'cds.climate.copernicus.eu'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  warnings.warn(


import cdsapi
from ecmwfapi import ECMWFService

warnings.simplefilter(
"ignore", category=urllib3.connectionpool.InsecureRequestWarning)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me. The only thought I have here is: should we do this for the CDS client only? WDYT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understood your meaning. Are you suggesting this be added in other files too? I wasn't actually sure the best place to add it, so I can put it wherever you suggest.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a CDS Client in this file, and that seems to be where the warnings are coming from. My suggestion was more or less: what if we put this on line 87 (the constructor of CdsClient)?

This way, it will only suppress these warnings. I can see an argument how we'd like to prevent this error trace form occurring everywhere, in which case we'd leave this line as is.

@alxmrs
Copy link
Collaborator

alxmrs commented Apr 8, 2022

Merging for now, we can revisit this warning suppression later.

@alxmrs alxmrs merged commit be7ec0e into google:main Apr 8, 2022
@pbattaglia pbattaglia deleted the suppress_urllib3_warning branch April 9, 2022 06:50
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

Successfully merging this pull request may close these issues.

2 participants