Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

decode multipart/form-data python

from requests_toolbelt.multipart import decoder

multipart_string = b"--ce560532019a77d83195f9e9873e16a1
Content-Disposition: form-data; name="author"

John Smith
--ce560532019a77d83195f9e9873e16a1
Content-Disposition: form-data; name="file"; filename="example2.txt"
Content-Type: text/plain
Expires: 0

Hello World
--ce560532019a77d83195f9e9873e16a1--
"
content_type = "multipart/form-data; boundary=ce560532019a77d83195f9e9873e16a1"

for part in decoder.MultipartDecoder(multipart_string, content_type).parts:
  print(part.text)

John Smith
Hello World
Comment

PREVIOUS NEXT
Code Example
Python :: remove element from dictionary python 
Python :: python extract specific keys from dictionary 
Python :: square root python 
Python :: numpy remove columns containing nan 
Python :: how to make a column a factor in pandas 
Python :: iterate backwards through a list python 
Python :: dataframe string find count 
Python :: python datetime object 
Python :: flask print to console 
Python :: python num2words installation 
Python :: python virtualenv 
Python :: ipynb to pdf cide 
Python :: try except python not working 
Python :: how to put a image in flask 
Python :: matplotlib styles attr 
Python :: find sum of factors of a number python 
Python :: how to access dataframe row by datetime index 
Python :: python split paragraph 
Python :: display array of odd rows and even columns in numpy 
Python :: find data in sheet pandas 
Python :: python pil 
Python :: pycocotools python3.7 
Python :: join dataframe pandas by column 
Python :: voice translate python 
Python :: dtype in pandas 
Python :: python isset 
Python :: matplotlib subplots 
Python :: python cv2 imwrite 
Python :: change django administration text 
Python :: in python how to use exp 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =