How do I transfer the contents of a stream to another in Python?
The trivial solution would be
output.write(input.read())
but that
shutil.copyfile and shutil.copyfileobj for the rescue. See http://docs.python.org/library/shutil.html#module-shutil
shutil.copyfile
shutil.copyfileobj