Merge pull request #3626 from krombel/only_import_secrets_when_available
Only import secrets when available
This commit is contained in:
commit
52384f2ee5
2 changed files with 4 additions and 4 deletions
1
changelog.d/3626.bugfix
Normal file
1
changelog.d/3626.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Only import secrets when available (fix for py < 3.6)
|
|
@ -20,17 +20,16 @@ See https://docs.python.org/3/library/secrets.html#module-secrets for the API
|
||||||
used in Python 3.6, and the API emulated in Python 2.7.
|
used in Python 3.6, and the API emulated in Python 2.7.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import six
|
import sys
|
||||||
|
|
||||||
if six.PY3:
|
# secrets is available since python 3.6
|
||||||
|
if sys.version_info[0:2] >= (3, 6):
|
||||||
import secrets
|
import secrets
|
||||||
|
|
||||||
def Secrets():
|
def Secrets():
|
||||||
return secrets
|
return secrets
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import binascii
|
import binascii
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue