title: python requests chunked encoding file and metadata
body: <p>How to send form data and files using chunked encoding?</p>
  
  <p>I tried:</p>
  
  <pre><code>def gen():
    a = f.read(1024)
    while a:
      yield a
      a = f.read(1024)
  r = requests.post(url, data=gen())
  </code></pre>
  
  <p>It is indeed sending a file using chunked encoding. However I cannot figure out how to append to this generator filename and form data in { "key" : "value" } format.</p>