Fixed #631 -- deprecate all of OpenSSL.rand (#658)
* Fixed #631 -- deprecate all of OpenSSL.rand
* syntax fix
* flake8
diff --git a/src/OpenSSL/rand.py b/src/OpenSSL/rand.py
index cf2053f..e2f6373 100644
--- a/src/OpenSSL/rand.py
+++ b/src/OpenSSL/rand.py
@@ -2,6 +2,7 @@
PRNG management routines, thin wrappers.
"""
+import warnings
from functools import partial
from six import integer_types as _integer_types
@@ -13,6 +14,12 @@
path_string as _path_string)
+warnings.warn(
+ "OpenSSL.rand is deprecated - you should use os.urandom instead",
+ DeprecationWarning, stacklevel=3
+)
+
+
class Error(Exception):
"""
An error occurred in an :mod:`OpenSSL.rand` API.