stats_can
stats_can copied to clipboard
SSL certificate verify failed
running the following on Python 3.7 Virtual env , Win 10
from stats_can import StatsCan
sc = StatsCan()
df = sc.table_to_df("271-000-22-01")
error code: SSLError: HTTPSConnectionPool(host='www150.statcan.gc.ca', port=443): Max retries exceeded with url: /t1/wds/rest/getCubeMetadata (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])")))
Hi @girmax. I just ran the same setup on my machine and it seems to be ok. That's going to make it difficult to troubleshoot.
Given that it's an SSL error I think the first thing to check would be if you can get a response from your browser. That api is a little tricky to call from the browser, but see what you get with this: https://www150.statcan.gc.ca/t1/wds/rest/getChangedCubeList/2017-12-07 If that loads some json in your browser then try the equivalent stats_can functionality:
import stats_can
stats_can.get_changed_cube_list()
and see if it retrieves something similar looking.
Hope that helps, please report back what you find.
hi @ianepreston .
It gives me json output below when i try https://www150.statcan.gc.ca/t1/wds/rest/getChangedCubeList/2017-12-07 in the browser.
{"status":"SUCCESS","object":[{"responseStatusCode":0,"productId":32100077,"releaseTime":"2017-12-07T08:30"},{"responseStatusCode":0,"productId":34100001,"releaseTime":"2017-12-07T08:30"},{"responseStatusCode":0,"productId":34100002,"releaseTime":"2017-12-07T08:30"},{"responseStatusCode":0,"productId":34100003,"releaseTime":"2017-12-07T08:30"},{"responseStatusCode":0,"productId":34100004,"releaseTime":"2017-12-07T08:30"},{"responseStatusCode":0,"productId":34100005,"releaseTime":"2017-12-07T08:30"},{"responseStatusCode":0,"productId":34100006,"releaseTime":"2017-12-07T08:30"},{"responseStatusCode":0,"productId":34100007,"releaseTime":"2017-12-07T08:30"},{"responseStatusCode":0,"productId":34100008,"releaseTime":"2017-12-07T08:30"},
When i run fron anaconda env the following
import stats_can
stats_can.get_changed_cube_list()
i get SSLError: HTTPSConnectionPool(host='www150.statcan.gc.ca', port=443): Max retries exceeded with url: /t1/wds/rest/getChangedCubeList/2019-12-17 (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])")))
Hi @girmax, I'll try and reproduce on my end. Can you send me your conda environment? Either this or this would be fine.
Hi @girmax, was this an issue in a Linux OS? I had a similar issue and it was solved by modifying the OpenSSL.cnf.
@girmax Are you in a corporate network? If so, sounds like a CA certs issue to me.