class_docstr: The ``MultipartEncoder`` object is a generic interface to the engine that
  will create a ``multipart/form-data`` body for you.
  
  The basic usage is:
  
  .. code-block:: py
  
      import requests
      from requests_toolbelt import MultipartEncoder
  
      encoder = MultipartEncoder({'field': 'value',
                                  'other_field': 'other_value'})
      r = requests.post('https://httpbin.org/post', data=encoder,
                        headers={'Content-Type': encoder.content_type})
  
  If you do not need to take advantage of streaming the post body, you can
  also do:
  
  .. code-block:: py
  
      r = requests.post('https://httpbin.org/post',
                        data=encoder.to_string(),
                        headers={'Content-Type': encoder.content_type})
  
  If you want the encoder to use a specific order, you can use an
  OrderedDict or more simply, a list of tuples:
  
  .. code-block:: py
  
      encoder = MultipartEncoder([('field', 'value'),
                                  ('other_field', 'other_value')])
  
  .. versionchanged:: 0.4.0
  
  You can also provide tuples as part values as you would provide them to
  requests' ``files`` parameter.
  
  .. code-block:: py
  
      encoder = MultipartEncoder({
          'field': ('file_name', b'{"a": "b"}', 'application/json',
                    {'X-My-Header': 'my-value'})
      ])
  
  .. warning::
  
      This object will end up directly in :mod:`httplib`. Currently,
      :mod:`httplib` has a hard-coded read size of **8192 bytes**. This
      means that it will loop until the file has been read and your upload
      could take a while. This is **not** a bug in requests. A feature is
      being considered for this object to allow you, the user, to specify
      what size should be returned on a read. If you have opinions on this,
      please weigh in on `this issue`_.
  
  .. _this issue:
      https://github.com/requests/toolbelt/issues/75
class_docstr_tok: ["The","``","MultipartEncoder","``","object","is","a","generic","interface","to","the","engine","that","will","create","a","``","multipart\/form-data","``","body","for","you",".","The","basic","usage","is",":","..","code-block",":",":","py","import","requests","from","requests_toolbelt","import","MultipartEncoder","encoder","=","MultipartEncoder","(","{","'field","'",":","'value","'",",","'other_field","'",":","'other_value","'","}",")","r","=","requests.post","(","'https",":","\/\/httpbin.org\/post","'",",","data=encoder",",","headers=","{","'Content-Type","'",":","encoder.content_type","}",")","If","you","do","not","need","to","take","advantage","of","streaming","the","post","body",",","you","can","also","do",":","..","code-block",":",":","py","r","=","requests.post","(","'https",":","\/\/httpbin.org\/post","'",",","data=encoder.to_string","(",")",",","headers=","{","'Content-Type","'",":","encoder.content_type","}",")","If","you","want","the","encoder","to","use","a","specific","order",",","you","can","use","an","OrderedDict","or","more","simply",",","a","list","of","tuples",":","..","code-block",":",":","py","encoder","=","MultipartEncoder","(","[","(","'field","'",",","'value","'",")",",","(","'other_field","'",",","'other_value","'",")","]",")","..","versionchanged",":",":","0.4.0","You","can","also","provide","tuples","as","part","values","as","you","would","provide","them","to","requests","'","``","files","``","parameter",".","..","code-block",":",":","py","encoder","=","MultipartEncoder","(","{","'field","'",":","(","'file_name","'",",","b","'","{","``","a","''",":","``","b","''","}","'",",","'application\/json","'",",","{","'","X-My-Header","'",":","'my-value","'","}",")","]",")","..","warning",":",":","This","object","will","end","up","directly","in",":","mod",":","`","httplib","`",".","Currently",",",":","mod",":","`","httplib","`","has","a","hard-coded","read","size","of","*","*","8192","bytes","*","*",".","This","means","that","it","will","loop","until","the","file","has","been","read","and","your","upload","could","take","a","while",".","This","is","*","*","not","*","*","a","bug","in","requests",".","A","feature","is","being","considered","for","this","object","to","allow","you",",","the","user",",","to","specify","what","size","should","be","returned","on","a","read",".","If","you","have","opinions","on","this",",","please","weigh","in","on","`","this","issue","`","_",".","..","_this","issue",":","https",":","\/\/github.com\/requests\/toolbelt\/issues\/75"]
code: def content_type(self):
      return str(
          "multipart/form-data; boundary={}".format(self.boundary_value)
      )
  
imports: import contextlib
  import io
  import os
  from uuid import uuid4
  import requests
  from .._compat import fields
label_desc: Use image node_id 14 for calling the MultipartEncoder obj's underlying member method code with example usage: obj.content_type() and returns: str