use urandom
This commit is contained in:
parent
5378970187
commit
aae2b07517
1 changed files with 3 additions and 3 deletions
|
@ -5,7 +5,8 @@ from __future__ import print_function
|
||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
import mimetypes
|
import mimetypes
|
||||||
import random
|
import os
|
||||||
|
import hashlib
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from six import PY2
|
from six import PY2
|
||||||
|
@ -20,8 +21,7 @@ _fmt = '%%0%dd' % _width
|
||||||
|
|
||||||
def _make_boundary():
|
def _make_boundary():
|
||||||
# Craft a random boundary.
|
# Craft a random boundary.
|
||||||
token = random.randrange(sys.maxsize)
|
boundary = ('=' * 15) + hashlib.sha1(os.urandom(32)).hexdigest() + '=='
|
||||||
boundary = ('=' * 15) + (_fmt % token) + '=='
|
|
||||||
return boundary
|
return boundary
|
||||||
|
|
||||||
class MultiPartForm(object):
|
class MultiPartForm(object):
|
||||||
|
|
Loading…
Reference in a new issue