Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python formdata requests

import requests
from requests_toolbelt.multipart.encoder import MultipartEncoder

multipart_data = MultipartEncoder(
    fields={
            # a file upload field
            'file': ('file.zip', open('file.zip', 'rb'), 'text/plain')
            # plain text fields
            'field0': 'value0', 
            'field1': 'value1',
           }
    )

response = requests.post('http://httpbin.org/post', data=multipart_data,
                  headers={'Content-Type': multipart_data.content_type})
Comment

PREVIOUS NEXT
Code Example
Python :: merging df vertically 
Python :: python array scalar multiplication 
Python :: howe to print all values and keysin d 
Python :: python negative indexing 
Python :: pd df rename 
Python :: pandas print tabulate no index 
Python :: python list comprehension 
Python :: raku fibonacci 
Python :: python cholesky 
Python :: python smtp sendmail 
Python :: kubernetes python client 
Python :: os.execl 
Python :: flask login 
Python :: python alphabetical order 
Python :: print colored text in python 
Python :: python get substring between strings 
Python :: numpy array unique value counts 
Python :: bar plot bokeh 
Python :: how to find maximum number from python list 
Python :: python replace 
Python :: sentiment analysis french python 
Python :: python csv writer row by row 
Python :: Python Tkinter Message Widget 
Python :: python pip Failed to build cryptography 
Python :: how to reindex columns in pandas 
Python :: represent NaN with pandas in python 
Python :: double in python 
Python :: Display the data types of the DataFrame 
Python :: python - regexp to find part of an email address 
Python :: django queryset exists 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =