Can I use the secrets module with a version of Python earlier than 3.6?

1.1k Views Asked by At

Python's secrets module was introduced in version 3.6. I'm working on an application using Python 3.4. Is there a way I can import the secrets module in a 3.4 environment (a la from __future__ import print)?

If not, is there a 3rd party module with comparable functionality?

1

There are 1 best solutions below

0
Zero Piraeus On

A backport of the secrets module for Python versions 2.7, 3.4 and 3.5 now exists: the (somewhat confusingly named) python2-secrets.

Installation:

pip install python2-secrets