dataverse-client-python
dataverse-client-python copied to clipboard
dozens of STDERR lines about InsecurePlatformWarning when running tests
I'm getting dozens of InsecurePlatformWarning's when I run the tests on the system Python on my Mac.
I took a quick look at https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning but I'm not sure what we should advise people to do in the readme. All the solutions seem a bit complicated to me. If we can change our code a bit that might be nice (rather than requiring that people install a newer version of Python).
$ python -m unittest test_dataverse 2>&1 | grep InsecurePlatformWarning | sort | uniq -c
87 InsecurePlatformWarning
1 ../Users/pdurbin/.virtualenvs/dataverse-client-python/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
5 ./Users/pdurbin/.virtualenvs/dataverse-client-python/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
1 .s/Users/pdurbin/.virtualenvs/dataverse-client-python/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
80 /Users/pdurbin/.virtualenvs/dataverse-client-python/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
$ python --version
Python 2.7.6
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.10.3
BuildVersion: 14D131
My hack was to edit the file with vim /Users/pdurbin/.virtualenvs/dataverse-client-python/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py +79 and comment out the warning. :)
I'm actually not getting those warnings on my Mac (running 2.7.6), but I'm not sure why.
If you don't want the warnings to show up in the tests, it should be as easy as putting this at the top of dataverse/test/test_dataverse.py:
from requests.packages import urllib3
urllib3.disable_warnings()
thanks @rliebz that works for me, but still doesn't get the reason of the warnings... (I get it with other code, find this git through google)
I've silenced the warnings in the master branch using the method I described for the time being, but I'm leaving the issue open so that we can keep track of this and potentially come up with a safer solution.