shotgunsoftware/python-api — pull request #32 by aag (2013-01-09 03:21:53+00:00)
Title: Download attachment to file

I want to download some large files (1+ GB) from a Shotgun server. With the download_attachment() function, the whole file must be stored in memory before it can be saved to the disk. This is a problem because there might not be that much RAM available on the system I'm running the script on.

This commit adds a new function, download_attachment_to_file(), which streams the attachment directly to a file. It uses very little memory, no matter how large the file is.

I have tested the changes in Python 2.4.6 and 2.7.3, in Linux and Windows.

I'm not sure what the best way is to submit documentation changes, so here's a gist with Markdown documentation for the Methods Reference page on the wiki:
https://gist.github.com/4490286