An integer passed to the Multipart Encoder results in:
File "[REMOVED]/lib/python3.4/site-packages/requests_toolbelt/multipart/encoder.py", line 89, in __init__
self._prepare_parts()
File "[REMOVED]/lib/python3.4/site-packages/requests_toolbelt/multipart/encoder.py", line 171, in _prepare_parts
self.parts = [Part.from_field(f, enc) for f in fields]
File "[REMOVED]/lib/python3.4/site-packages/requests_toolbelt/multipart/encoder.py", line 171, in <listcomp>
self.parts = [Part.from_field(f, enc) for f in fields]
File "[REMOVED]/lib/python3.4/site-packages/requests_toolbelt/multipart/encoder.py", line 388, in from_field
body = coerce_data(field.data, encoding)
File "[REMOVED]/lib/python3.4/site-packages/requests_toolbelt/multipart/encoder.py", line 364, in coerce_data
return CustomBytesIO(data, encoding)
File "[REMOVED]/lib/python3.4/site-packages/requests_toolbelt/multipart/encoder.py", line 429, in __init__
buffer = encode_with(buffer, encoding)
File "[REMOVED]/lib/python3.4/site-packages/requests_toolbelt/multipart/encoder.py", line 326, in encode_with
return string.encode(item, encoding)
AttributeError: 'int' object has no attribute 'encode'
Python 3.4 was used for this test
Ubuntu LTS 14.04 Pip3 packages updated immediately prior to test
A temporary workaround is to force the int to string via prepending zeroes.
Hello,
The MultipartEncoder appears to not properly handle
int
's passed to the encoder.Example payload:
An integer passed to the Multipart Encoder results in:
A temporary workaround is to force the
int
to string via prepending zeroes.jxa