title: Encrypting streaming data from Python requests to boto storage
body: <p>I am using Python requests to download a file then immediately upload it to storage via boto. The download is streamed directly into boto to avoid storing the file locally. I would like to add an intermediate step to encrypt the stream after it is downloaded but before it is uploaded.</p>
  
  <p>Note that this is uploading into Google Cloud Storage, which supports streaming uploads. </p>
  
  <pre><code>import boto
  import gcs_oauth2_boto_plugin
  import requests
  
  url = 'https://www.example.com/file.tar.gz'
  
  r = requests.get(url, stream=True)
  
  filename = 'file.tar.gz'
  uri = boto.storage_uri(filename, 'gs')
  uri.new_key().set_contents_from_stream(r.raw)
  </code></pre>
  
  <p>What is the best way to iterate through the stream and encrypt it, before passing it through to set_contents_from_stream()? Ideally I would be using a standardised encryption library, not having to implement any of the encryption code myself.</p>