Skip to content

Instantly share code, notes, and snippets.

@aag
Last active December 10, 2015 20:48
Show Gist options
  • Save aag/4490286 to your computer and use it in GitHub Desktop.
Save aag/4490286 to your computer and use it in GitHub Desktop.
Documentation for the download_attachment_to_file() function that should be added to the Methods Reference page on the Shotgun API Wiki: https://github.com/shotgunsoftware/python-api/wiki/Reference%3A-Methods

download_attachment_to_file()

Description

None download_attachment_to_file(int entity_id, string file_path)

Saves the binary content of the specified attachment to the specified file path. If the file already exists, it will be overwritten. The script must have read and write permissions to the file path.

Parameters

  • int entity_id (required)
    The id of the Attachment to download.
  • string file_path (required)
    The path of the file to download to.

Returns

  • None

Usage Example

# ----------------------------------------------
# Download Attachment to a file
# ----------------------------------------------
 attachment_id = 12
 file_path = "/tmp/attachment.jpg"
 sg.download_attachment_to_file(attachment_id, file_path)

example output:

 None 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment