aboutsummaryrefslogtreecommitdiff
path: root/urllib3/filepost.py
diff options
context:
space:
mode:
Diffstat (limited to 'urllib3/filepost.py')
-rw-r--r--urllib3/filepost.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/urllib3/filepost.py b/urllib3/filepost.py
index 344a103..e679b93 100644
--- a/urllib3/filepost.py
+++ b/urllib3/filepost.py
@@ -7,11 +7,7 @@
import codecs
import mimetypes
-try:
- from mimetools import choose_boundary
-except ImportError:
- from .packages.mimetools_choose_boundary import choose_boundary
-
+from uuid import uuid4
from io import BytesIO
from .packages import six
@@ -20,6 +16,13 @@ from .packages.six import b
writer = codecs.lookup('utf-8')[3]
+def choose_boundary():
+ """
+ Our embarassingly-simple replacement for mimetools.choose_boundary.
+ """
+ return uuid4().hex
+
+
def get_content_type(filename):
return mimetypes.guess_type(filename)[0] or 'application/octet-stream'