cdsapi
cdsapi copied to clipboard
Repeating InsecureRequestWarning at every download
What happened?
A test download:
import cdsapi
c=cdsapi.Client()
url = c.retrieve('reanalysis-era5-pressure-levels', {
"variable": "temperature",
"pressure_level": "1000",
"product_type": "reanalysis",
"date": "2017-12-01/2017-12-08",
"time": "12:00",
"format": "netcdf"
}, 'era5_P_1lvl_1week.nc')
The data downloads all right, but it gives a worrying repeating Warning:
InsecureRequestWarning: Unverified HTTPS request is being made to host 'download-0014-clone.copernicus-climate.eu'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
Currently my .cdsapirc consists of:
url: https://cds.climate.copernicus.eu/api/v2
key: (...removed...)
verify: 0
Question: how to add the verification?
What are the steps to reproduce the bug?
import cdsapi
c=cdsapi.Client()
url = c.retrieve('reanalysis-era5-pressure-levels', {
"variable": "temperature",
"pressure_level": "1000",
"product_type": "reanalysis",
"date": "2017-12-01/2017-12-08",
"time": "12:00",
"format": "netcdf"
}, 'era5_P_1lvl_1week.nc')
Version
v0.6.1 (latest)
Platform (OS and architecture)
VS Code on Windows 11
Relevant log output
C:\Users\<user>\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py:1045: 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/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
2023-12-11 16:51:29,464 INFO Welcome to the CDS
2023-12-11 16:51:29,464 INFO Sending request to https://cds.climate.copernicus.eu/api/v2/resources/reanalysis-era5-pressure-levels
C:\Users\<user>\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py:1045: 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/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
2023-12-11 16:51:29,541 INFO Request is queued
C:\Users\<user>\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py:1045: 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/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
C:\Users\<user>\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py:1045: 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/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
C:\Users\<user>\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py:1045: 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/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
2023-12-11 16:51:34,543 INFO Request is running
C:\Users\<user>\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py:1045: 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/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
2023-12-11 16:51:38,004 INFO Request is completed
2023-12-11 16:51:38,005 INFO Downloading https://download-0014-clone.copernicus-climate.eu/cache-compute-0014/cache/data6/adaptor.mars.internal-1702306294.232011-32732-7-11b1ae95-cef6-4bc4-9448-8dcfd31a5c28.nc to era5_P_1lvl_1week.nc (15.9M)
C:\Users\<user>\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'download-0014-clone.copernicus-climate.eu'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
2023-12-11 16:51:42,706 INFO Download rate 3.4M/s
Accompanying data
No response
Organisation
No response
Remove the verify: 0 line from your .cdsapirc file. It disables certificate verification, which leads to the warnings you see.
Unfortunately this line is part of the example config in the readme and you probably copied it from there. It really shouldn't be in there and I opened a PR to remove it.